當前位置: 首頁>>代碼示例>>C#>>正文


C# ListBox.Refresh方法代碼示例

本文整理匯總了C#中System.Windows.Forms.ListBox.Refresh方法的典型用法代碼示例。如果您正苦於以下問題:C# ListBox.Refresh方法的具體用法?C# ListBox.Refresh怎麽用?C# ListBox.Refresh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Forms.ListBox的用法示例。


在下文中一共展示了ListBox.Refresh方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: refreshNeighborPanel

        /*
        private void refreshNeighborPanel(string toIgnore = null)
        {
            panelTest.Controls.Clear();

            listNeighborComboBox.Clear();
            listNeighborCheckBox.Clear();
            listNeighborButton.Clear();

            //add all the new components to the panel
            List<string> temp = featGraph.getFeatureNames();
            int counter = 0;
            for (int x = 0; x < temp.Count; x++)
            {
                if (temp[x] == toIgnore)
                {
                    counter = 1;
                    continue;
                }
                CheckBox checkBoxTemp = new CheckBox();
                checkBoxTemp.AutoSize = true;
                checkBoxTemp.Location = new System.Drawing.Point(3, 3 + (49 * (x-counter) ) );
                checkBoxTemp.Name = "checkBoxNeighbor" + x.ToString();
                checkBoxTemp.Size = new System.Drawing.Size(80, 17);
                checkBoxTemp.Text = temp[x];
                checkBoxTemp.UseVisualStyleBackColor = true;
                panelTest.Controls.Add(checkBoxTemp);
                listNeighborCheckBox.Add(checkBoxTemp);

                ComboBox comboBoxTemp = new ComboBox();
                comboBoxTemp.FormattingEnabled = true;
                comboBoxTemp.Location = new System.Drawing.Point(3, 25 + (49 * (x-counter) ) );
                comboBoxTemp.Name = "comboBoxNeighbor" + x.ToString();
                comboBoxTemp.Size = new System.Drawing.Size(141, 21);
                comboBoxTemp.Enabled = false;
                panelTest.Controls.Add(comboBoxTemp);
                listNeighborComboBox.Add(comboBoxTemp);

                Button buttonTemp = new Button();
                buttonTemp.Location = new System.Drawing.Point(150, 25 + (49 * (x-counter) ) );
                buttonTemp.Name = "buttonNeighbor" + x.ToString();
                buttonTemp.Size = new System.Drawing.Size(44, 21);
                buttonTemp.TabIndex = 13;
                buttonTemp.Text = "Add";
                buttonTemp.UseVisualStyleBackColor = true;
                buttonTemp.Enabled = false;
                panelTest.Controls.Add(buttonTemp);
                listNeighborButton.Add(buttonTemp);
            }
        }
        */
        private void refreshFeatureTagListBox(ListBox toRefresh)
        {
            toRefresh.Items.Clear();
            if (selectedIndex == -1) { toRefresh.Refresh(); return; }
            List<string> tmp = featGraph.Features[selectedIndex].getTagKeys();
            for (int x = tmp.Count-1; x >= 0; x--)
            {
                toRefresh.Items.AddRange(new object[] { tmp[x] });
            }
            toRefresh.Refresh();
        }
開發者ID:smiled0g,項目名稱:ChineseDialogueSpring2015,代碼行數:62,代碼來源:Form1.cs

示例2: FillVariableListBox

 /// <summary>
 /// FillVariableListBox()
 /// ListBox and ComboBox both derive from ListControl
 /// According to Help file Items property of ListControl is Public.
 /// Contrary to helpfile there is no such property.
 /// So polymorphism could not be used as expected
 /// </summary>
 /// <param name="lbx">ListBox to be filled</param>
 /// <param name="scopeWord">The scope of the variable</param>
 protected void FillVariableListBox(ListBox lbx, VariableType scopeWord)
 {
     lbx.Items.Clear();
     VariableCollection vars = this.EpiInterpreter.Context.MemoryRegion.GetVariablesInScope(scopeWord);
     lbx.BeginUpdate();
     foreach (IVariable var in vars)
     {
         if (!(var is Epi.Fields.PredefinedDataField))
         {
             lbx.Items.Add(var.Name.ToString());
         }
     }
     lbx.EndUpdate();
     lbx.Sorted = true;
     lbx.Refresh();
 }
開發者ID:NALSS,項目名稱:epiinfo-82474,代碼行數:25,代碼來源:CommandDesignDialog.cs

示例3: refreshFeatureListBox

 //Helper functions to refresh listbox that contains a list of feature
 private void refreshFeatureListBox(ListBox toRefresh, string toIgnore = null)
 {
     toRefresh.Items.Clear();
     List<string> tmp = featGraph.getFeatureNames();
     for (int x = 0; x < tmp.Count; x++)
     {
         if (toIgnore != null && tmp[x] != toIgnore)
         {
             toRefresh.Items.AddRange(new object[] { tmp[x] });
         }
         else if (toIgnore == null)
         {
             toRefresh.Items.AddRange(new object[] { tmp[x] });
         }
     }
     toRefresh.Refresh();
 }
開發者ID:smiled0g,項目名稱:ChineseDialogueSpring2015,代碼行數:18,代碼來源:Form1.cs


注:本文中的System.Windows.Forms.ListBox.Refresh方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。