PowerTools PlusPak for Windows Forms 8.0J
ContextMenuStrip プロパティ (ColorPickerDropDownSettings)
使用例 

色ドロップダウンウィンドウに関連付けられたContextMenuStripを取得または設定します。
構文
Public Property ContextMenuStrip As ContextMenuStrip
public ContextMenuStrip ContextMenuStrip {get; set;}

プロパティ値

色ドロップダウンウィンドウのContextMenuStripContextMenuStripがない場合はnull 参照 (Visual Basicでは Nothing)。デフォルトはnull 参照 (Visual Basicでは Nothing)です。
解説
色ドロップダウンウィンドウにContextMenuも割り当てられている場合は、ContextMenuの方がContextMenuStripよりも優先されます。
使用例

次のサンプルコードは、GcColorPicker.DropDownSettingsプロパティ上でContextMenuStripプロパティを設定して、GcColorPickerのドロップダウンウィンドウのSystem.Windows.Forms.ContextMenuStripを設定します。この例を実行するには、以下のコードをSystem.Windows.Forms.Formに追加し、ここで作成したメソッドをコンストラクターまたはフォーム上の別のメソッドから呼び出す必要があります。

private void CreateGcColorPickerWithDropDownSettings()
{
    // Create an instance of GcColorPicker control.
    GcColorPicker gcColorPicker = new GcColorPicker();

    // Initialize the Name and Location of the gcColorPicker.
    gcColorPicker.Name = "gcColorPicker";
    gcColorPicker.Location = new Point(10, 50);

    // Custom the drop-down settings for gcColorPicker.
    gcColorPicker.DropDownSettings.AutoDropDown = true;
    gcColorPicker.DropDownSettings.ShowShadow = false;
    gcColorPicker.DropDownSettings.OpeningAnimation = GrapeCity.Win.Common.DropDownAnimation.Extend;
    gcColorPicker.DropDownSettings.ClosingAnimation = GrapeCity.Win.Common.DropDownAnimation.Extend;
    gcColorPicker.DropDownSettings.DropDownDirection = GrapeCity.Win.Common.DropDownDirection.BelowLeft;

    // Initialize and set a shortcut menu for gcColorPicker's drop-down window.
    ContextMenuStrip myMenu = new ContextMenuStrip();
    myMenu.Items.Add("menu1");
    gcColorPicker.DropDownSettings.ContextMenuStrip = myMenu;

    // adds gcColorPicker to the form.
    this.Controls.Add(gcColorPicker);
}
Private Sub CreateGcColorPickerWithDropDownSettings()
    ' Create an instance of GcColorPicker control.
    Dim gcColorPicker As New GcColorPicker()

    ' Initialize the Name and Location of the gcColorPicker.
    gcColorPicker.Name = "gcColorPicker"
    gcColorPicker.Location = New Point(10, 50)

    ' Custom the drop-down settings for gcColorPicker.
    gcColorPicker.DropDownSettings.AutoDropDown = True
    gcColorPicker.DropDownSettings.ShowShadow = False
    gcColorPicker.DropDownSettings.OpeningAnimation = DropDownAnimation.Extend
    gcColorPicker.DropDownSettings.ClosingAnimation = DropDownAnimation.Extend
    gcColorPicker.DropDownSettings.DropDownDirection = DropDownDirection.BelowLeft

    ' Initialize and set a shortcut menu for gcColorPicker's drop-down window.
    Dim myMenu As New ContextMenuStrip()
    myMenu.Items.Add("menu1")
    gcColorPicker.DropDownSettings.ContextMenuStrip = myMenu

    ' adds gcColorPicker to the form.
    Me.Controls.Add(gcColorPicker)
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

参照

ColorPickerDropDownSettings クラス
ColorPickerDropDownSettings メンバ

Send Feedback