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


C# ListBox.EndUpdate方法代码示例

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


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

示例1: ReadFile

        public static int ReadFile(string fileName, ListBox listbox)
        {
            if (File.Exists(fileName))
            {
                using (StreamReader sr = new StreamReader(new FileStream(fileName, FileMode.Open)))
                {
                    listbox.BeginUpdate();

                    while (!sr.EndOfStream)
                    {
                        string str = sr.ReadLine();

                        if(str.Length > 0)
                            listbox.Items.Add(str);
                    }

                    listbox.EndUpdate();

                    sr.Close();

                    return 0;
                }
            }

            return -1;
        }
开发者ID:NeuroWhAI,项目名称:WhenFullScreen,代码行数:26,代码来源:ListboxDataFile.cs

示例2: OnEdit

 /// <summary>
 /// ¬озвращает измененное значение свойства
 /// </summary>
 /// <param name="value">»сходное значение</param>
 protected override Object OnEdit(Object value)
 {
     // создаем выпадающий список значений
     ListBox valuesList = new ListBox();
     valuesList.BorderStyle = BorderStyle.None;
     valuesList.BeginUpdate();
     try
     {
         // заполн¤ем список значени¤ми
         valuesList.Items.AddRange(Values);
     }
     finally
     {
         valuesList.EndUpdate();
     }
     // определ¤ем высоту списка
     Int32 heightMultiplier = valuesList.Items.Count > 7 ? 7 : valuesList.Items.Count;
     valuesList.Height = valuesList.ItemHeight * (heightMultiplier + 1);
     // выбираем строку в списке в зависимости от значени¤ свойства
     valuesList.SelectedIndex = ObjectToIndex(value);
     // добавл¤ем поддержку закрыти¤ по щелчку мыши
     valuesList.Click += new EventHandler(valuesList_Click);
     // открываем список значений
     EdSvc.DropDownControl(valuesList);
     // возвращаем выбранное значение свойства
     return IndexToObject(valuesList.SelectedIndex);
 }
开发者ID:Dennis-Petrov,项目名称:Cash,代码行数:31,代码来源:CustomDropdownEditor.cs

示例3: ChemtoolsGui

        private ChemtoolsGui()
        {
            this.Text = "ChemTools";
            this.Size = new Size(640, 640);

            input = new TextBox();
            input.Location = new Point(20, 20);
            input.Size = new Size(250, 20);
            input.TextChanged += new EventHandler(InputChanged);
            input.KeyDown += new KeyEventHandler(InputKeyDown);

            output = new RichTextBox();
            output.Location = new Point(50, 160);
            output.Size = new Size(250, 300);

            savedList = new ListBox();
            savedList.Location = new Point(300, 20);
            savedList.Size = new Size(300, 120);
            savedList.SelectedIndexChanged += new EventHandler(ListSelectChange);
            savedList.KeyDown += new KeyEventHandler(ListKeyDown);
            savedList.BeginUpdate();
            savedList.Items.Add("H2O");
            savedList.Items.Add("CO2");
            savedList.Items.Add("C4H10+O2=CO2+H2O");
            savedList.Items.Add("44.0095gCO2");
            savedList.EndUpdate();

            savedOutput = new RichTextBox();
            savedOutput.Location = new Point(300, 160);
            savedOutput.Size = new Size(250, 300);

            btnAdd = new Button();
            btnAdd.Location = new Point(180, 50);
            btnAdd.Text = "Save";
            btnAdd.Click += new EventHandler(AddClick);

            btnDelete = new Button();
            btnDelete.Location = new Point(180, 100);
            btnDelete.Text = "Delete";
            btnDelete.Click += new EventHandler(DeleteClick);

            btnClear = new Button();
            btnClear.Location = new Point(20, 50);
            btnClear.Text = "Clear";
            btnClear.Click += new EventHandler(ClearClick);

            btnReset = new Button();
            btnReset.Location = new Point(20, 100);
            btnReset.Text = "Reset All";
            btnReset.Click += new EventHandler(ResetClick);

            this.Controls.Add(input);
            this.Controls.Add(output);
            this.Controls.Add(savedList);
            this.Controls.Add(savedOutput);
            this.Controls.Add(btnAdd);
            this.Controls.Add(btnDelete);
            this.Controls.Add(btnClear);
            this.Controls.Add(btnReset);
        }
开发者ID:tcooc,项目名称:ChemtoolsCs,代码行数:60,代码来源:ChemtoolsGui.cs

示例4: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            // Create an instance of the ListBox.
            ListBox listBox1 = new ListBox();
            // Set the size and location of the ListBox.
            listBox1.Size = new System.Drawing.Size(200, 100);
            listBox1.Location = new System.Drawing.Point(10, 10);
            // Add the ListBox to the form.
            this.Controls.Add(listBox1);
            // Set the ListBox to display items in multiple columns.
            listBox1.MultiColumn = true;
            // Set the selection mode to multiple and extended.
            listBox1.SelectionMode = SelectionMode.MultiExtended;

            // Shutdown the painting of the ListBox as items are added.
            listBox1.BeginUpdate();
            // Loop through and add 50 items to the ListBox.
            for (int x = 1; x <= 50; x++)
            {
                listBox1.Items.Add("Item " + x.ToString());
            }
            // Allow the ListBox to repaint and display the new items.
            listBox1.EndUpdate();

            // Select three items from the ListBox.
            listBox1.SetSelected(1, true);
            listBox1.SetSelected(3, true);
            listBox1.SetSelected(5, true);

            // Display the second selected item in the ListBox to the console.
            System.Diagnostics.Debug.WriteLine(listBox1.SelectedItems[1].ToString());
            // Display the index of the first selected item in the ListBox.
            System.Diagnostics.Debug.WriteLine(listBox1.SelectedIndices[0].ToString());
        }
开发者ID:klimskuridin,项目名称:vamk_csharp,代码行数:34,代码来源:Form1.cs

示例5: FillListBox

 public static int FillListBox(ListBox lb, List<string> list)
 {
     lb.BeginUpdate();
     foreach(var s in list)
     lb.Items.Add(s);
     lb.EndUpdate();
     return lb.Items.Count;
 }
开发者ID:emm274,项目名称:fcObj,代码行数:8,代码来源:xedits.cs

示例6: Populate

 /// <summary>
 /// Clears and fills the control with the given data. 
 /// </summary>
 /// <param name="ctrl">Listbox control to fill</param>
 /// <param name="data">List of data</param>
 /// <param name="none">Flag to fill the first position with "None"</param>
 /// <remarks>Painting is suspended until after items have been added</remarks>
 public static void Populate(ListBox ctrl, IList<dynamic> data, bool none)
 {
     ctrl.BeginUpdate();
     ctrl.Items.Clear();
     if (none)
         ctrl.Items.Add("<None>");
     for (int i = 1; i < data.Count; i++)
         ctrl.Items.Add(data[i].ToString());
     ctrl.EndUpdate();
 }
开发者ID:borisblizzard,项目名称:arcreator,代码行数:17,代码来源:ControlHelper.cs

示例7: SetListItems

        public static void SetListItems(ListBox listBox, ListItemWithId[] items)
        {
            listBox.Text = "";
            listBox.Items.Clear();

            listBox.BeginUpdate();

            for (int i = 0; i < items.Length; i++)
                listBox.Items.Add(items[i]);

            listBox.EndUpdate();
        }
开发者ID:gitfunk,项目名称:7thSea,代码行数:12,代码来源:SeventhSeaUtils.cs

示例8: MoveComponent

        private void MoveComponent(ListBox source, ListBox dest, IEnumerable<DeckManager.Components.BaseComponent> items)
        {
            source.BeginUpdate();
            dest.BeginUpdate();

            source.Items.Remove(items);
            dest.Items.AddRange(items.ToArray());

            // probably a better way to get the nodenames but whatever
            DeckManager.Boards.Dradis.DradisNodeName SourceNode;
            _sectors.TryGetValue(source, out SourceNode);
            DeckManager.Boards.Dradis.DradisNodeName DestNode;
            _sectors.TryGetValue(dest, out DestNode);
            Program.GManager.MoveComponents(SourceNode, DestNode, items);

            source.EndUpdate();
            dest.EndUpdate();
            // todo add rollback on error checking?
        }
开发者ID:MaxPeck,项目名称:DeckManager,代码行数:19,代码来源:DradisForm.cs

示例9: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            ListBox listBox = new ListBox();
            listBox.SelectionMode = SelectionMode.One;
            listBox.SelectedValueChanged += OnListBoxSelectedValueChanged;
            listBox.DisplayMember = nameof(AbstractSkin.Name);
            listBox.BeginUpdate();
            foreach (var skinType in WinFwkHelper.GetDerivedTypes(typeof(AbstractSkin)))
            {
                var skin = Activator.CreateInstance(skinType);
                listBox.Items.Add(skin);
            }
            listBox.EndUpdate();
            listBox.Sorted = true;
            editorService.DropDownControl(listBox);
            if (listBox.SelectedItem == null) // no selection, return the passed-in value as is
                return value;

            return listBox.SelectedItem;
        }
开发者ID:fremag,项目名称:MemoScope.Net,代码行数:22,代码来源:SkinTypeEditor.cs

示例10: NewDecisionListBox

        public ListBox NewDecisionListBox(List<DecisionTree> dtChildren)
        {
            ListBox retVal = new ListBox();
            retVal.Font = new Font("Courier New", 8);
            retVal.ScrollAlwaysVisible = true;
            retVal.Width = 223;
            retVal.BeginUpdate();

            foreach (DecisionTree curDecision in dtChildren)
            {
                if (curDecision.Move != null)
                {
                    if ((curDecision.Parent != null) &&
                        (curDecision.Parent.BestChildMove != null) &&
                        (curDecision.Parent.BestChildMove == curDecision.Move))
                    {
                        curDecision.Move.ToStringPrefix = "-> ";
                    }
                    else
                    {
                        curDecision.Move.ToStringPrefix = "   ";
                    }
                }
                else
                {
                    retVal.Width = 140;
                }

                retVal.Items.Add(curDecision);
            }

            retVal.EndUpdate();

            retVal.Height = this.splitContainer1.Panel2.Height - this.hScrollBar1.Height;
            retVal.SelectedIndexChanged += this.OnSelectedIndexChanged;

            return retVal;
        }
开发者ID:ErichDonGubler,项目名称:uvschess,代码行数:38,代码来源:GuiDecisionTree.cs

示例11: CompareListsNew

        private static void CompareListsNew(IList<Article> list1, List<Article> list2, ListBox lb1, ListBox lb2, ListBox lb3)
        {
            lb1.BeginUpdate();
            lb2.BeginUpdate();
            lb3.BeginUpdate();

            lb1.Items.AddRange(list1.Except(list2).ToArray());
            lb2.Items.AddRange(list2.Except(list1).ToArray());
            lb3.Items.AddRange(list1.Intersect(list2).ToArray());

            lb1.EndUpdate();
            lb2.EndUpdate();
            lb3.EndUpdate();
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:14,代码来源:ListComparer.cs

示例12: AddListBox

 /// <summary>
 /// adds item to list box
 /// </summary>
 /// <param name="obj"></param>
 /// <param name="text"></param>
 private void AddListBox(ListBox obj, string text)
 {
     if (obj.InvokeRequired)
     {
         AddListBoxCallback tcb = new AddListBoxCallback(AddListBox);
         this.Invoke(tcb, new Object[] { obj, text });
     }
     else
     {
         if (obj.Items.Contains(text)) return;
         obj.BeginUpdate();
         obj.Items.Add(text);
         obj.EndUpdate();
     }
 }
开发者ID:CWentz,项目名称:LMessenger,代码行数:20,代码来源:LMServer.cs

示例13: OnSelected

        public override void OnSelected( ListBox subList, params Button[] buttons )
        {
            m_EnableBTN = buttons[4];

            buttons[0].Text = Language.GetString( LocString.AddTarg );
            buttons[0].Visible = true;
            buttons[1].Text = Language.GetString( LocString.Remove );
            buttons[1].Visible = true;
            buttons[2].Text = Language.GetString( LocString.RemoveTarg );
            buttons[2].Visible = true;
            buttons[3].Text = Language.GetString( LocString.ClearList );
            buttons[3].Visible = true;
            buttons[4].Text = Language.GetString( m_Enabled ? LocString.PushDisable : LocString.PushEnable );
            buttons[4].Visible = true;

            m_SubList = subList;
            subList.BeginUpdate();
            subList.Items.Clear();
            for(int i=0;i<m_Chars.Count;i++)
                Add2List( (Serial)m_Chars[i] );
            subList.EndUpdate();
        }
开发者ID:herculesjr,项目名称:razor,代码行数:22,代码来源:Agents.cs

示例14: displaySongs

 public void displaySongs(ListBox box)
 {
     box.BeginUpdate();
     box.Items.Clear();
     foreach (Song song in this.SongList.Values)
     {
         if (!song.Deleted)
         {
             box.Items.Add(song);
         }
     }
     Util.NRSONGS = box.Items.Count;
     box.EndUpdate();
 }
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:14,代码来源:Storage.cs

示例15: InitializeListBox

    void InitializeListBox(ListBox box,SelectableListNodeList list)
    {
      box.BeginUpdate();
      box.Items.Clear();


      for (int i = 0; i < list.Count; i++)
      {
        SelectableListNode node = list[i];

        box.Items.Add(node);
        if (node.Selected)
          box.SelectedIndices.Add(i);
      }

      box.EndUpdate();
    }
开发者ID:Altaxo,项目名称:Altaxo,代码行数:17,代码来源:PlotGroupCollectionControl.cs


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