本文整理匯總了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());
}