本文整理汇总了C#中System.Windows.Forms.DomainUpDown类的典型用法代码示例。如果您正苦于以下问题:C# DomainUpDown类的具体用法?C# DomainUpDown怎么用?C# DomainUpDown使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DomainUpDown类属于System.Windows.Forms命名空间,在下文中一共展示了DomainUpDown类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MySub
protected DomainUpDown domainUpDown1;
private void MySub()
{
// Create and initialize the DomainUpDown control.
domainUpDown1 = new System.Windows.Forms.DomainUpDown();
// Add the DomainUpDown control to the form.
Controls.Add(domainUpDown1);
}
private void button1_Click(System.Object sender,
System.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(System.Object sender,
System.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(System.Object sender,
System.EventArgs e)
{
// Display the SelectedIndex and SelectedItem property values in a MessageBox.
MessageBox.Show("SelectedIndex: " + domainUpDown1.SelectedIndex.ToString()
+ "\n" + "SelectedItem: " + domainUpDown1.SelectedItem.ToString());
}