DomainUpDown クラスとは? わかりやすく解説

DomainUpDown クラス

文字列値を表示する Windows スピン ボックス (アップダウン コントロール) を表します

名前空間: System.Windows.Forms
アセンブリ: 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
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class DomainUpDown extends UpDownBase
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class DomainUpDown extends
 UpDownBase
解説解説

DomainUpDown コントロールは、コントロールの上向き矢印ボタンまたは下向き矢印ボタンクリックしてObject コレクションから選択される 1 つ文字列値を表示しますReadOnly プロパティtrue設定されている場合除きユーザーコントロールテキスト入力することもできます (入力する文字列が、受け入れられるようにするには、コレクション内の項目と一致する必要があります)。項目を選択すると、オブジェクトは文字列値に変換されスピン ボックス表示されます。

DomainUpDown コントロール表示するオブジェクトコレクション作成するには、Add メソッドおよび Remove メソッド使用して、項目を個別追加または削除します。これは、ボタンClick イベントなどイベント ハンドラ呼び出すことができますSorted プロパティtrue設定すると、オブジェクトコレクションアルファベット順並べ替えることができますWrap プロパティtrue設定されると、コレクション最初または最後オブジェクト超えてスクロールする場合リスト最初または最後オブジェクト戻り継続的に表示されます。

コード使用するか、または上向き矢印ボタン下向き矢印ボタンどちらかクリックして、UpButton メソッドまたは DownButton メソッド呼び出すと、UpdateEditText が呼び出され新しい文字列でコントロール更新します。UserEdit が true設定されている場合コントロールテキスト表示更新される前に文字列コレクション内の値の 1 つ一致します

使用例使用例

DomainUpDown コントロール作成し初期化するコード例次に示します。この例では、プロパティ一部設定してスピン ボックス表示する文字列コレクション作成できます。このコードは、TextBoxCheckBox、および 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.Object
   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
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DomainUpDown メンバ
System.Windows.Forms 名前空間
UpDownBase
NumericUpDown


このページでは「.NET Framework クラス ライブラリ リファレンス」からDomainUpDown クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDomainUpDown クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDomainUpDown クラス を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DomainUpDown クラス」の関連用語

DomainUpDown クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DomainUpDown クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS