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

ドロップダウンピッカーの項目を取得します。
構文
Public ReadOnly Property Items As ColorPickerItemCollection
public ColorPickerItemCollection Items {get;}

プロパティ値

GcColorPicker のドロップダウンウィンドウに表示されるピッカー項目を含む ColorPickerItemCollection
使用例

次のサンプルコードは、新しい GcColorPicker コントロールを定義する方法を示します。このサンプルコードを実行するには、以下のコードを System.Windows.Forms.Form プロジェクトに追加し、ここで作成したメソッドをコンストラクタまたはフォーム上の別のメソッドから呼び出します。

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

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

    // Use CustomColorsPalatte to create a color picker which look like 
    // the color picker in WordPad.
    gcColorPicker1.Items.Clear();
    gcColorPicker1.Items.Add(new CustomColorsPalette());

    // adds gcColorPicker to the form.
    this.Controls.Add(gcColorPicker1);

    // Create an instance of GcColorPicker control.
    GcColorPicker gcColorPicker2 = new GcColorPicker();

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

    // Use CustomColorsPalatte to create a color picker which look like 
    // the color picker in WordPad.
    gcColorPicker2.Items.Clear();
    CustomColorsPalette s = new CustomColorsPalette();
    s.CaptionVisible = false;
    s.ColorBlockSize = 14;
    s.ColumnSpace = 6;
    s.RowSpace = 0;
    s.ColumnCount = 5;
    s.Colors = new Color[30];
    s.Colors[0] = Color.White;
    s.Colors[1] = Color.Red;
    s.Colors[2] = Color.FromArgb(192, 80, 77);
    s.Colors[3] = Color.FromArgb(209, 99, 73);
    s.Colors[4] = Color.FromArgb(221, 132, 132);
    s.Colors[5] = Color.FromArgb(204, 204, 204);
    s.Colors[6] = Color.FromArgb(255, 192, 0);
    s.Colors[7] = Color.FromArgb(247, 150, 70);
    s.Colors[8] = Color.FromArgb(209, 144, 73);
    s.Colors[9] = Color.FromArgb(243, 164, 71);
    s.Colors[10] = Color.FromArgb(165, 165, 165);
    s.Colors[11] = Color.Yellow;
    s.Colors[12] = Color.FromArgb(155, 187, 89);
    s.Colors[13] = Color.FromArgb(204, 180, 0);
    s.Colors[14] = Color.FromArgb(223, 206, 4);
    s.Colors[15] = Color.FromArgb(102, 102, 102);
    s.Colors[16] = Color.FromArgb(0, 176, 80);
    s.Colors[17] = Color.FromArgb(75, 172, 198);
    s.Colors[18] = Color.FromArgb(143, 176, 140);
    s.Colors[19] = Color.FromArgb(165, 181, 146);
    s.Colors[20] = Color.FromArgb(51, 51, 51);
    s.Colors[21] = Color.FromArgb(0, 77, 187);
    s.Colors[22] = Color.FromArgb(79, 129, 189);
    s.Colors[23] = Color.FromArgb(100, 107, 134);
    s.Colors[24] = Color.FromArgb(128, 158, 194);
    s.Colors[25] = Color.Black;
    s.Colors[26] = Color.FromArgb(155, 0, 211);
    s.Colors[27] = Color.FromArgb(128, 100, 162);
    s.Colors[28] = Color.FromArgb(158, 124, 124);
    s.Colors[29] = Color.FromArgb(156, 133, 192);
    gcColorPicker2.Items.Add(new SeparateLineItem());
    AutomaticColorItem a = new AutomaticColorItem();
    gcColorPicker2.Items.Add(a);
    gcColorPicker2.Items.Add(s);
    gcColorPicker2.Items.Add(new SeparateLineItem());
    gcColorPicker2.Items.Add(new MoreColorsItem());
    gcColorPicker2.Items.Add(new SeparateLineItem());

    // adds gcColorPicker to the form.
    this.Controls.Add(gcColorPicker2);
}

private void CreateGcColorPickerLookLikeVisualStudioColorPickerWithItems()
{
    // 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);

    // Use CustomColorsPalatte to create a color picker which look like 
    // the color picker in VisualStudio.
    gcColorPicker.Items.Clear();
    gcColorPicker.Items.Add(new VisualStudioColorEditor());

    // adds gcColorPicker to the form.
    this.Controls.Add(gcColorPicker);
}

private void CreateGcColorPickerHasBiggerColorBlockSizeWithItems()
{
    // 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);

    // Use CustomColorsPalatte to create a color picker which 
    // has bigger color block size.
    gcColorPicker.Items.Clear();
    ThemeColorsPalette themeColorsPalette = new ThemeColorsPalette();
    themeColorsPalette.CaptionFont = new Font("Segoe UI Semibold", 13F, FontStyle.Bold | FontStyle.Italic);
    themeColorsPalette.ColorBlockSize = 20;
    gcColorPicker.Items.Add(themeColorsPalette);

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

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

    ' Use CustomColorsPalatte to create a color picker which look like 
    ' the color picker in WordPad.
    gcColorPicker1.Items.Clear()
    gcColorPicker1.Items.Add(New CustomColorsPalette())

    ' adds gcColorPicker to the form.
    Me.Controls.Add(gcColorPicker1)

    ' Create an instance of GcColorPicker control.
    Dim gcColorPicker2 As New GcColorPicker()

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

    ' Use CustomColorsPalatte to create a color picker which look like 
    ' the color picker in WordPad.
    gcColorPicker2.Items.Clear()
    Dim s As New CustomColorsPalette()
    s.CaptionVisible = False
    s.ColorBlockSize = 14
    s.ColumnSpace = 6
    s.RowSpace = 0
    s.ColumnCount = 5
    s.Colors = New Color(29) {}
    s.Colors(0) = Color.White
    s.Colors(1) = Color.Red
    s.Colors(2) = Color.FromArgb(192, 80, 77)
    s.Colors(3) = Color.FromArgb(209, 99, 73)
    s.Colors(4) = Color.FromArgb(221, 132, 132)
    s.Colors(5) = Color.FromArgb(204, 204, 204)
    s.Colors(6) = Color.FromArgb(255, 192, 0)
    s.Colors(7) = Color.FromArgb(247, 150, 70)
    s.Colors(8) = Color.FromArgb(209, 144, 73)
    s.Colors(9) = Color.FromArgb(243, 164, 71)
    s.Colors(10) = Color.FromArgb(165, 165, 165)
    s.Colors(11) = Color.Yellow
    s.Colors(12) = Color.FromArgb(155, 187, 89)
    s.Colors(13) = Color.FromArgb(204, 180, 0)
    s.Colors(14) = Color.FromArgb(223, 206, 4)
    s.Colors(15) = Color.FromArgb(102, 102, 102)
    s.Colors(16) = Color.FromArgb(0, 176, 80)
    s.Colors(17) = Color.FromArgb(75, 172, 198)
    s.Colors(18) = Color.FromArgb(143, 176, 140)
    s.Colors(19) = Color.FromArgb(165, 181, 146)
    s.Colors(20) = Color.FromArgb(51, 51, 51)
    s.Colors(21) = Color.FromArgb(0, 77, 187)
    s.Colors(22) = Color.FromArgb(79, 129, 189)
    s.Colors(23) = Color.FromArgb(100, 107, 134)
    s.Colors(24) = Color.FromArgb(128, 158, 194)
    s.Colors(25) = Color.Black
    s.Colors(26) = Color.FromArgb(155, 0, 211)
    s.Colors(27) = Color.FromArgb(128, 100, 162)
    s.Colors(28) = Color.FromArgb(158, 124, 124)
    s.Colors(29) = Color.FromArgb(156, 133, 192)
    gcColorPicker2.Items.Add(New SeparateLineItem())
    Dim a As New AutomaticColorItem()
    gcColorPicker2.Items.Add(a)
    gcColorPicker2.Items.Add(s)
    gcColorPicker2.Items.Add(New SeparateLineItem())
    gcColorPicker2.Items.Add(New MoreColorsItem())
    gcColorPicker2.Items.Add(New SeparateLineItem())

    ' adds gcColorPicker to the form.
    Me.Controls.Add(gcColorPicker2)
End Sub

Private Sub CreateGcColorPickerLookLikeVisualStudioColorPickerWithItems()
    ' 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)

    ' Use CustomColorsPalatte to create a color picker which look like 
    ' the color picker in VisualStudio.
    gcColorPicker.Items.Clear()
    gcColorPicker.Items.Add(New VisualStudioColorEditor())

    ' adds gcColorPicker to the form.
    Me.Controls.Add(gcColorPicker)
End Sub

Private Sub CreateGcColorPickerHasBiggerColorBlockSizeWithItems()
    ' 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)

    ' Use CustomColorsPalatte to create a color picker which 
    ' has bigger color block size.
    gcColorPicker.Items.Clear()
    Dim themeColorsPalette As New ThemeColorsPalette()
    themeColorsPalette.CaptionFont = New Font("Segoe UI Semibold", 13.0F, FontStyle.Bold Or FontStyle.Italic)
    themeColorsPalette.ColorBlockSize = 20
    gcColorPicker.Items.Add(themeColorsPalette)

    ' 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

参照

GcColorPicker クラス
GcColorPicker メンバ

Send Feedback