本文整理汇总了C#中System.Windows.Forms.DomainUpDown.DomainUpDownItemCollection类的典型用法代码示例。如果您正苦于以下问题:C# DomainUpDown.DomainUpDownItemCollection类的具体用法?C# DomainUpDown.DomainUpDownItemCollection怎么用?C# DomainUpDown.DomainUpDownItemCollection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DomainUpDown.DomainUpDownItemCollection类属于System.Windows.Forms命名空间,在下文中一共展示了DomainUpDown.DomainUpDownItemCollection类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeMyDomainUpDown
protected DomainUpDown domainUpDown1;
private void InitializeMyDomainUpDown()
{
// Create and initialize the DomainUpDown control.
domainUpDown1 = new DomainUpDown();
// Add the DomainUpDown control to the form.
Controls.Add(domainUpDown1);
}
private void button1_Click(Object sender,
EventArgs e)
{
// Add the text box contents and initial location in the collection
// to the DomainUpDown control.
domainUpDown1.Items.Add((textBox1.Text.Trim()) + " - " + myCounter);
// Increment the counter variable.
myCounter = myCounter + 1;
// Clear the TextBox.
textBox1.Text = "";
}
private void checkBox1_Click(Object sender,
EventArgs e)
{
// If Sorted is set to true, set it to false;
// otherwise set it to true.
if (domainUpDown1.Sorted)
{
domainUpDown1.Sorted = false;
}
else
{
domainUpDown1.Sorted = true;
}
}
private void domainUpDown1_SelectedItemChanged(Object sender,
EventArgs e)
{
// Display the SelectedIndex and
// SelectedItem property values in a MessageBox.
MessageBox.Show("SelectedIndex: " + domainUpDown1.SelectedIndex.ToString()
+ "\n" + "SelectedItem: " + domainUpDown1.SelectedItem.ToString());
}