DomainUpDown クラス
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ <ComVisibleAttribute(True)> _ Public Class DomainUpDown Inherits UpDownBase
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] [ComVisibleAttribute(true)] public class DomainUpDown : UpDownBase
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] [ComVisibleAttribute(true)] public ref class DomainUpDown : public UpDownBase

DomainUpDown コントロールは、コントロールの上向き矢印ボタンまたは下向き矢印ボタンをクリックして、Object コレクションから選択される 1 つの文字列値を表示します。ReadOnly プロパティが true に設定されている場合を除き、ユーザーはコントロールにテキストを入力することもできます (入力する文字列が、受け入れられるようにするには、コレクション内の項目と一致する必要があります)。項目を選択すると、オブジェクトは文字列値に変換され、スピン ボックスに表示されます。
DomainUpDown コントロールに表示するオブジェクトのコレクションを作成するには、Add メソッドおよび Remove メソッドを使用して、項目を個別に追加または削除します。これは、ボタンの Click イベントなどのイベント ハンドラで呼び出すことができます。Sorted プロパティを true に設定すると、オブジェクトのコレクションをアルファベット順に並べ替えることができます。Wrap プロパティが true に設定されると、コレクションの最初または最後のオブジェクトを超えてスクロールする場合、リストは最初または最後のオブジェクトに戻り、継続的に表示されます。
コードを使用するか、または上向き矢印ボタンと下向き矢印ボタンのどちらかをクリックして、UpButton メソッドまたは DownButton メソッドを呼び出すと、UpdateEditText が呼び出され、新しい文字列でコントロールを更新します。UserEdit が true に設定されている場合、コントロールのテキスト表示が更新される前に、文字列がコレクション内の値の 1 つに一致します。

DomainUpDown コントロールを作成し、初期化するコード例を次に示します。この例では、プロパティの一部を設定して、スピン ボックスに表示する文字列のコレクションを作成できます。このコードは、TextBox、CheckBox、および Button がフォーム上でインスタンス化されていることを前提にしています。この例は、myCounter という名前の 32 ビット符号付き整数として宣言されたクラス レベルのメンバ変数があることも前提にしています。テキスト ボックスに文字列を入力すると、ボタンがクリックされたときにその文字列を Items コレクションに追加できます。チェック ボックスをクリックすると、Sorted プロパティを切り替えて、スピン ボックス内の項目のコレクションの違いを確認できます。
Protected domainUpDown1 As DomainUpDown Private Sub MySub() ' Create and initialize the DomainUpDown control. domainUpDown1 = New System.Windows.Forms.DomainUpDown() ' Add the DomainUpDown control to the form. Controls.Add(domainUpDown1) End Sub 'MySub Private Sub button1_Click(sender As System.Object, e As System.EventArgs) ' 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 = "" End Sub 'button1_Click Private Sub checkBox1_Click(sender As System.Object, e As System.EventArgs) ' If Sorted is set to true, set it to false; ' otherwise set it to true. If domainUpDown1.Sorted Then domainUpDown1.Sorted = False Else domainUpDown1.Sorted = True End If End Sub 'checkBox1_Click Private Sub domainUpDown1_SelectedItemChanged _ (sender As System.Object, e As System.EventArgs) ' Display the SelectedIndex and SelectedItem property values in a MessageBox. MessageBox.Show(("SelectedIndex: " & domainUpDown1.SelectedIndex.ToString() & _ ControlChars.Cr & "SelectedItem: " & domainUpDown1.SelectedItem.ToString())) End Sub 'domainUpDown1_SelectedItemChanged
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()); }
protected: DomainUpDown^ domainUpDown1; private: void MySub() { // Create and initialize the DomainUpDown control. domainUpDown1 = gcnew System::Windows::Forms::DomainUpDown; // Add the DomainUpDown control to the form. Controls->Add( domainUpDown1 ); } 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( String::Concat( (textBox1->Text->Trim()), " - ", myCounter.ToString() ) ); // Increment the counter variable. myCounter = myCounter + 1; // Clear the TextBox. textBox1->Text = ""; } 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; } } void domainUpDown1_SelectedItemChanged( Object^ sender, EventArgs^ e ) { // Display the SelectedIndex and SelectedItem property values in a MessageBox. MessageBox::Show( String::Concat( "SelectedIndex: ", domainUpDown1->SelectedIndex.ToString(), "\n", "SelectedItem: ", domainUpDown1->SelectedItem->ToString() ) ); }
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. get_Controls().Add(domainUpDown1); } //MySub private void button1_Click(Object sender, System.EventArgs e) { // Add the text box contents and initial location in the collection // to the DomainUpDown control. domainUpDown1.get_Items().Add((textBox1.get_Text().Trim() + " - " + myCounter)); // Increment the counter variable. myCounter = myCounter + 1; // Clear the TextBox. textBox1.set_Text(""); } //button1_Click private void checkBox1_Click(Object sender, System.EventArgs e) { // If Sorted is set to true, set it to false; // otherwise set it to true. if (domainUpDown1.get_Sorted()) { domainUpDown1.set_Sorted(false); } else { domainUpDown1.set_Sorted(true); } } //checkBox1_Click private void domainUpDown1_SelectedItemChanged(Object sender, System.EventArgs e) { // Display the SelectedIndex and SelectedItem property values in a // MessageBox. MessageBox.Show(("SelectedIndex: " + System.Convert.ToString(domainUpDown1.get_SelectedIndex()) + "\n" + "SelectedItem: " + System.Convert.ToString(domainUpDown1.get_SelectedItem()))); } //domainUpDown1_SelectedItemChanged

System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ScrollableControl
System.Windows.Forms.ContainerControl
System.Windows.Forms.UpDownBase
System.Windows.Forms.DomainUpDown


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からDomainUpDown クラスを検索する場合は、下記のリンクをクリックしてください。

- DomainUpDown クラスのページへのリンク