当前位置: 首页>>代码示例>>C#>>正文


C# ListView.EndUpdate方法代码示例

本文整理汇总了C#中System.Windows.Forms.ListView.EndUpdate方法的典型用法代码示例。如果您正苦于以下问题:C# ListView.EndUpdate方法的具体用法?C# ListView.EndUpdate怎么用?C# ListView.EndUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.ListView的用法示例。


在下文中一共展示了ListView.EndUpdate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Popola

        public static void Popola(ref ListView aListView, IList aListOfData)
        {
            aListView.SuspendLayout();
            aListView.BeginUpdate();
            aListView.Items.Clear();

            if (ListUtils.isNotEmpty(aListOfData))
            {
                foreach (object item in aListOfData)
                {
                    if (item is IListViewItemable)
                    {
                        aListView.Items.Add(((IListViewItemable)item).toListViewItem());
                    }
                    else if (item is DateTime)
                    {
                        ListViewItem dateItem = new ListViewItem(item.ToString());
                        dateItem.Tag = item;

                        aListView.Items.Add(dateItem);
                    }
                    else
                    {
                        aListView.Items.Add(((IListViewItemable)item).ToString());
                    }
                }
            }

            aListView.EndUpdate();
            aListView.ResumeLayout();
        }
开发者ID:mattocchi,项目名称:VS2005Commons,代码行数:31,代码来源:ListViewUtils.cs

示例2: PopulateListView

 void PopulateListView(ListView lv, List<KeyValuePair<string, Type>> map, Predicate<KeyValuePair<string, Type>> match)
 {
     lv.Visible = false;
     lv.BeginUpdate();
     lv.Items.Clear();
     string fmt = "{0:D" + (map.Count.ToString().Length) + "}";
     int order = 0;
     foreach (var kvp in map)
     {
         order++;
         if (!match(kvp)) continue;
         string tag = getTag(kvp.Key);
         string wrapper = kvp.Value.Name;
         string file = System.IO.Path.GetFileName(kvp.Value.Assembly.Location);
         string title = GetAttrValue(kvp.Value.Assembly, typeof(System.Reflection.AssemblyTitleAttribute), "Title");
         string description = GetAttrValue(kvp.Value.Assembly, typeof(System.Reflection.AssemblyDescriptionAttribute), "Description");
         string company = GetAttrValue(kvp.Value.Assembly, typeof(System.Reflection.AssemblyCompanyAttribute), "Company");
         string product = GetAttrValue(kvp.Value.Assembly, typeof(System.Reflection.AssemblyProductAttribute), "Product");
         ListViewItem lvi = new ListViewItem(new string[] { String.Format(fmt, order), tag, kvp.Key, wrapper, file, title, description, company, product, });
         lvi.Tag = kvp;
         lv.Items.Add(lvi);
     }
     if (lv.Items.Count > 0)
         lv.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
     lv.EndUpdate();
     lv.Visible = true;
 }
开发者ID:dwalternatio,项目名称:Sims4Tools,代码行数:27,代码来源:ManageWrappersDialog.cs

示例3: AddListViewData

        //添加单行数据
        public void AddListViewData(ListView list, Dictionary<string, string> data)
        {
            if (list.InvokeRequired)//不能访问就创建委托
            {
                ListViewDelegate d = new ListViewDelegate(AddListViewData);
                list.Invoke(d, new object[] { list, data });
            }
            else
            {
                list.BeginUpdate();
                ListViewItem list_item = new ListViewItem();
                bool need_init = true;
                foreach (KeyValuePair<string, string> cell in data)
                {
                    ListViewItem.ListViewSubItem list_sub_item = new ListViewItem.ListViewSubItem();
                    if (need_init)
                    {
                        list_item.Text = cell.Value;
                        need_init = false;
                    }
                    else
                    {
                        list_sub_item.Text = cell.Value;
                        list_item.SubItems.Add(list_sub_item);
                    }
                }
                list.Items.Add(list_item);
                list.EnsureVisible(list.Items.Count - 1);
                list.EndUpdate();

            }
        }
开发者ID:zhujunxxxxx,项目名称:TaokeThief,代码行数:33,代码来源:Form1.cs

示例4: AddChecked

        public void AddChecked(IEnumerable<string> list, ListView listView)
        {
            if (list == null)
            {
                return;
            }

            ImageList imageList = new ImageList();
            imageList.ImageSize = new Size(16, 16);
            imageList.ColorDepth = ColorDepth.Depth32Bit;
            // Add a default image at position 0;
            imageList.Images.Add(Properties.Resources.Tick_16x16);

            var pagelist = list.ToArray();
            ListViewItem[] items = new ListViewItem[pagelist.Length];
            for (int i = 0; i < pagelist.Length; i++)
            {
                ListViewItem item = new ListViewItem(pagelist[i].Substring(pagelist[i].LastIndexOf('.') + 1));
                item.ImageIndex = 0;
                items[i]= item;
            }

            listView.Invoke((Action)(() =>
            {
                listView.LargeImageList = imageList;
                listView.SmallImageList = imageList;

                listView.BeginUpdate();
                listView.Items.Clear();
                listView.Items.AddRange(items);

                listView.EndUpdate();
            }));
        }
开发者ID:hanchao,项目名称:DotSpatial,代码行数:34,代码来源:ListViewHelper.cs

示例5: UpdateList

        /// <summary>
        /// Helper function that fills in the list of revisions.
        /// This is used from the code above and from the FormRevisionHistory.
        /// </summary>
        public static void UpdateList(ListView listRev, string input)
        {
            App.StatusBusy(true);
            string[] response = input.Split(new[] { Environment.NewLine }, StringSplitOptions.None);

            listRev.BeginUpdate();
            listRev.Items.Clear();

            foreach (string s in response)
            {
                string[] cat = s.Split('\t');

                // Convert the date/time from UNIX second based to C# date structure
                DateTime date = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Convert.ToDouble(cat[1])).ToLocalTime();
                cat[1] = String.Format("{0:yyyy/MM/dd  HH:mm:ss}", date);

                // Trim any spaces in the subject line
                cat[3] = cat[3].Trim();
                // Limit the subject line length to the length specified for that
                int c1 = Convert.ToInt32(Properties.Settings.Default.commitW1);
                if (cat[3].Length > c1)
                    cat[3] = cat[3].Substring(0, c1) + "...";

                ListViewItem li = new ListViewItem(cat);
                li.Name = cat[0];           // Used to search for a key
                li.Tag = cat[0];            // Tag contains the SHA1 of the commit
                listRev.Items.Add(li);
            }

            // Make columns auto-adjust to fit the width of the largest item
            foreach (ColumnHeader l in listRev.Columns) l.Width = -2;

            listRev.EndUpdate();
            App.StatusBusy(false);
        }
开发者ID:splintor,项目名称:GitForce,代码行数:39,代码来源:PanelRevlist.cs

示例6: ShwMsgforView

        /// <summary>
        /// 用于在listview中显示对应Ip是否在线
        /// </summary>
        /// <param name="lvi">绑定的控件</param>
        /// <param name="text">在线信息</param>
        public void ShwMsgforView(ListView lvi, string[] text)
        {
            if (lvi.InvokeRequired)
            {
                ShwMsgforViewCallBack shwMsgforViewCallBack = ShwMsgforView;
                lvi.Invoke(shwMsgforViewCallBack, new object[] { lvi, text });
                int count = lvi.Items.Count;
                int rownum = IsExistsItem(text[1], lvi);
                if (rownum >= 0)
                {
                    lvi.BeginUpdate();
                    lvi.Items[rownum].SubItems[1].Text = text[1];
                    lvi.Items[rownum].SubItems[2].Text = text[0];
                    //------------------记录
                    lvi.EndUpdate();

                }
                else
                {
                    string[] str = new string[]{
                       (count+1).ToString(),
                       text[1],
                         text[0],
                         " ",
                        " ",
                        " ",
                          " ",
                        " ",
                          " ",
                        " ",
                          " ",
                          " "
                    };

                    ListViewItem lit = new ListViewItem(str);
                    lvi.BeginUpdate();
                    lvi.Items.Add(lit);
                    lvi.EndUpdate();
                }

            }
            else
            {

            }
        }
开发者ID:konglinghai123,项目名称:SocketNetWatch,代码行数:51,代码来源:UIShow.cs

示例7: InitialListView

 public void InitialListView(ListView listView)
 {
     listView.Clear();
     InsertAllColumns(listView);
     listView.BeginUpdate();
     AddFlowItem(listView);
     listView.EndUpdate();
 }
开发者ID:wyntung,项目名称:HLZDGL,代码行数:8,代码来源:FlowInfo.cs

示例8: FilterExperimentsListView

        /// <summary>Filters an Experiments listview control, using filter text and type</summary>
        /// <param name="lv">Experiments ListView to filter</param>
        /// <param name="text">Text to look for</param>
        /// <param name="type">The filter type (i.e. column to filter)</param>
        public static void FilterExperimentsListView(ListView lv, string text, ComboBox type)
        {
            int column = MainForm.COL_INDEX_NAME;
            string filterType = type.SelectedItem == null ? "Name" : type.SelectedItem.ToString();

            switch (filterType)
            {
                case "Name":
                    // set by default
                    break;
                case "Institute":
                    column = MainForm.COL_INDEX_INSTITUTE;
                    break;
                case "Dataset":
                    column = MainForm.COL_INDEX_DATASET;
                    break;
                case "Tags":
                    column = MainForm.COL_INDEX_TAGS;
                    break;
            }

            lv.BeginUpdate();

            for (int i = lv.Items.Count - 1; i >= 0; i--)
            {
                ListViewItem lvi = lv.Items[i];

                if (column != MainForm.COL_INDEX_TAGS)
                {
                    ListViewItem.ListViewSubItem lvsi = lvi.SubItems[column];
                    if (!lvsi.Text.Contains(text))
                    {
                        lv.Items.Remove(lvi);
                    }
                }
                else
                {
                    string[] tags = text.Split(',');
                    bool containsTag = false;
                    ListViewItem.ListViewSubItem lvsi = lvi.SubItems[column];

                    foreach (string tag in tags)
                    {
                        if (lvsi.Text.Contains(tag))
                        {
                            containsTag = true;
                        }
                    }

                    if (!containsTag)
                    {
                        lv.Items.Remove(lvi);
                    }
                }
            }

            lv.EndUpdate();
        }
开发者ID:svileng,项目名称:itranscriptome,代码行数:62,代码来源:FormHelper.cs

示例9: FillListView

 public static void FillListView(ListView _listView, List<IBaseElement> _listEl)
 {
     _listView.Clear();
     _listView.BeginUpdate();
     foreach (IBaseElement row in _listEl)
     {
         var item = new ListViewItem(row.name);
         _listView.Items.Add(item);
     }
     _listView.EndUpdate();
 }
开发者ID:AleksandrIstratov,项目名称:FProject,代码行数:11,代码来源:baseElement.cs

示例10: AddPackages

        public void AddPackages(IEnumerable<IPackage> list, ListView listView)
        {
            ImageList imageList = new ImageList();
            imageList.ImageSize = new Size(32, 32);
            imageList.ColorDepth = ColorDepth.Depth32Bit;
            // Add a default image at position 0;
            imageList.Images.Add(DotSpatial.Plugins.ExtensionManager.Properties.Resources.box_closed_32x32);

            var tasks = new List<Task<Image>>();

            listView.BeginUpdate();
            listView.Items.Clear();
            foreach (var package in list)
            {
                ListViewItem item = new ListViewItem(package.Id);

                string description = null;
                if (package.Description.Length > 56)
                {
                    description = package.Description.Substring(0, 53) + "...";
                }
                else
                {
                    description = package.Description;
                }
                item.SubItems.Add(description);
                item.ImageIndex = 0;

                listView.Items.Add(item);
                item.Tag = package;

                var task = BeginGetImage(package.IconUrl.ToString());
                tasks.Add(task);
            }
            listView.EndUpdate();

            Task<Image>[] taskArray = tasks.ToArray();
            if (taskArray.Count() == 0) return;

            Task.Factory.ContinueWhenAll(taskArray, t =>
            {
                for (int i = 0; i < taskArray.Length; i++)
                {
                    if (taskArray[i].Result != null)
                    {
                        imageList.Images.Add(taskArray[i].Result);
                        listView.Items[i].ImageIndex = imageList.Images.Count - 1;
                    }
                }
            }, new System.Threading.CancellationToken(), TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());

            listView.LargeImageList = imageList;
        }
开发者ID:pedrolandaacurio,项目名称:gvix,代码行数:53,代码来源:ListViewHelper.cs

示例11: SelectionChangeTester

		public SelectionChangeTester (ListViewDescriptor descriptor)
		{
			this.descriptor = descriptor;

			lv = new ListView ();
			lv.View = descriptor.View;

			lv.BeginUpdate ();
			for (int i = 0; i < descriptor.ItemCount; i++)
				lv.Items.Add ("Item " + i);
			lv.EndUpdate ();
		}
开发者ID:hitswa,项目名称:winforms,代码行数:12,代码来源:SelectionChangeTester.cs

示例12: ListViewFixColumns

 public static void ListViewFixColumns(ListView lst)
 {
     lst.BeginUpdate();
     for (int i = 0; i < lst.Columns.Count; i++)
     {
         lst.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
         int width = lst.Columns[i].Width;
         lst.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
         lst.Columns[i].Width = System.Math.Max(width, lst.Columns[i].Width);
     }
     lst.EndUpdate();
 }
开发者ID:sunshinemistery,项目名称:Store,代码行数:12,代码来源:Utilities.cs

示例13: OrderView

 public OrderView(string order_id, string path)
 {
     InitializeComponent();
     this.orderID = order_id;
     this.outPath = path;
     this.resultList = new ArrayList();
     this.bluetoothList = bluetoothListView;
     bluetoothList.BeginUpdate();
     bluetoothList.View = View.Details;
     loadListTitle();
     bluetoothList.EndUpdate();
     getOrderView();
 }
开发者ID:sh932111,项目名称:BrainProject,代码行数:13,代码来源:OrderView.cs

示例14: ClearListView

 /// <summary>
 /// Czyszczenie listView.
 /// </summary>
 /// <param name="listView">Element ListView do wyczyszczenie.</param>
 /// <returns>Zwracanie czystej ListView.</returns> 
 public static ListView ClearListView(ListView listView)
 {
     if (listView.InvokeRequired)
     {
         InvokeClearLV del = new InvokeClearLV(ClearListView);
         listView.Invoke(del, listView);
         return listView;
     }
     listView.BeginUpdate();
     listView.Items.Clear();
     listView.EndUpdate();
     return listView;
 }
开发者ID:rafaliusz,项目名称:main,代码行数:18,代码来源:ListViewConfig.cs

示例15: OrderList

 public OrderList(string path,Boolean isc)
 {
     InitializeComponent();
     this.isClient = isc;
     this.outPath = path;
     this.resultList = new ArrayList();
     this.bluetoothList = bluetoothListView;
     this.bluetoothList = bluetoothListView;
     bluetoothList.BeginUpdate();
     bluetoothList.View = View.Details;
     loadListTitle();
     bluetoothList.EndUpdate();
     getOrderList();
 }
开发者ID:sh932111,项目名称:BrainProject,代码行数:14,代码来源:OrderList.cs


注:本文中的System.Windows.Forms.ListView.EndUpdate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。