PowerTools PlusPak for Windows Forms 8.0J
PickingColor イベント
使用例 

マウスで色を採取しているときに発生します。
構文
イベント データ

イベント ハンドラが、このイベントに関連するデータを含む、PickingColorEventArgs 型の引数を受け取りました。次の PickingColorEventArgs プロパティには、このイベントの固有の情報が記載されます。

プロパティ解説
Color採取されている色を取得します。  
使用例

次のサンプルコードは、ColorPickerButtonを使用して画面から色を採取しているときに、PickingColorイベントを使用してタスクを実行する方法を示します。この例では、PickingColorイベントに接続されたイベントハンドラで、BackColorを採取された色に設定しています。

このサンプルコードは、GrapeCity.Win.Containers.GcComboFrameクラスの概要に示されている詳細なコード例の一部を抜粋したものです。その元の例では、最初にcomboBox1からColorPickerButton項目を選択してgcComboFrame1にColorPickerButtonを表示し、次にColorPickerButtonを使用して画面から色を採取できます。

private void ColorPickerButton_PickingColor(object sender, PickingColorEventArgs e)
{
    // Set textBox1's Text property to the picking color.
    this.textBox1.Text = e.Color.ToString();

    // Set ColorPickerButton's background color to the picking color.
    (sender as ColorPickerButton).BackColor = e.Color;
}
Private Sub ColorPickerButton_PickingColor(ByVal sender As Object, ByVal e As PickingColorEventArgs)
    ' Set textBox1's Text property to the picking color.
    Me.textBox1.Text = e.Color.ToString()

    ' Set ColorPickerButton's background color to the picking color.
    TryCast(sender, ColorPickerButton).BackColor = e.Color
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

参照

ColorPickerButton クラス
ColorPickerButton メンバ

Send Feedback