PowerTools PlusPak for Windows Forms 8.0J
DropDownControl プロパティ
使用例 

ドロップダウンウィンドウに表示されるSystem.Windows.Forms.Controlオブジェクトを取得または設定します。
構文
Public Property DropDownControl As Control
public Control DropDownControl {get; set;}

プロパティ値

GcComboFrameのドロップダウンコントロールを表すSystem.Windows.Forms.Control
例外
例外解説
System.ArgumentException

指定されたコントロールがトップレベルコントロールです。

または

指定されたコントロールが、このGcComboFrameインスタンスの親です。

または

指定されたコントロールが、ContentPanelの子である内容コントロールです。

解説

ウィンドウコントロールをGcComboFrameのドロップダウンコントロールにするには、そのコントロールをDropDownControlプロパティに設定します。そうすると、設定したコントロールが元の親コントロールから削除され、このGcComboFrameのドロップダウンウィンドウに追加されます。あるコントロールをDropDownControlとして設定すると、その位置が(0,0)にリセットされ、ドロップダウンウィンドウのサイズがこのコントロールが収まるサイズに変更されます。

設計時には、DropDownControlプロパティが別のコントロールまたはnullに設定された場合、古いドロップダウンコントロールは、DropDownControlになる前の状態に戻ります。

使用例
次のサンプルコードは、GcComboFrameコントロールでのこのプロパティの使用方法を示します。この例では、listBox1という名前のSystem.Windows.Forms.ListBoxコントロールをgcComboFrame1のDropDownControlに指定し、四辺すべてをドロップダウンウィンドウにドッキングしています。そのため、ドロップダウンウィンドウが開いた後、listBox1が表示されます。この例を実行するには、gcComboFrame1という名前のGcComboFrameインスタンスとlistBox1という名前のSystem.Windows.Forms.ListBoxコントロールを含むSystem.Windows.Forms.Formに以下のコードを追加し、ここで作成したメソッドをコンストラクターまたはフォーム上の別のメソッドから呼び出す必要があります。
private void SetComboFrameDropDownControl()
{
    // Initialize the listBox1.
    this.listBox1.BorderStyle = BorderStyle.None;
    this.listBox1.Dock = DockStyle.Fill;
    this.listBox1.Items.AddRange(new string[] {
    "item1",
    "item2",
    "item3",
    "item4",
    "item5"});

    // Set listBox1 as gcComboFrame1's drop-down control.
    this.gcComboFrame1.DropDownControl = this.listBox1;
}
Private Sub SetComboFrameDropDownControl()
    ' Initialize the listBox1.
    Me.listBox1.BorderStyle = BorderStyle.None
    Me.listBox1.Dock = DockStyle.Fill
    Me.listBox1.Items.AddRange(New String() {"item1", "item2", "item3", "item4", "item5"})

    ' Set listBox1 as gcComboFrame1's drop-down control.
    Me.gcComboFrame1.DropDownControl = Me.listBox1
End Sub
プラットフォーム

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

参照

GcComboFrame クラス
GcComboFrame メンバ

Send Feedback