本文整理汇总了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();
}
示例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();
}
示例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();
}