本文整理匯總了C#中System.Windows.Forms.DomainUpDown.OnSelectedItemChanged方法的典型用法代碼示例。如果您正苦於以下問題:C# DomainUpDown.OnSelectedItemChanged方法的具體用法?C# DomainUpDown.OnSelectedItemChanged怎麽用?C# DomainUpDown.OnSelectedItemChanged使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.DomainUpDown
的用法示例。
在下文中一共展示了DomainUpDown.OnSelectedItemChanged方法的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());
}