GrapeCity.Win.Common 名前空間 : EndPickColorEventArgs クラス |
Public Class EndPickColorEventArgs Inherits System.EventArgs
public class EndPickColorEventArgs : System.EventArgs
次のサンプルコードは、この型の使用方法を示します。この例では、色採取操作が正常に完了した場合に、採取された色をlistBox1に格納しています。
このサンプルコードは、GrapeCity.Win.Containers.GcComboFrameクラスの概要に示されている詳細なコード例の一部を抜粋したものです。その元の例では、最初にcomboBox1からColorPickerButton項目を選択してgcComboFrame1にColorPickerButtonを表示し、次にColorPickerButtonを使用して画面から色を採取できます。
private void ColorPickerButton_EndPickColor(object sender, EndPickColorEventArgs e) { // Add the color into listBox1 if the picking of color is succussful. if (PickColorResult.OK == e.Result) { DialogResult result = MessageBox.Show("Do you want to add the color into list box ?", "Picking color successful", MessageBoxButtons.YesNo); if (DialogResult.Yes == result) { this.listBox1.Items.Add(e.Color.ToString()); } } // Clear the text. this.textBox1.Clear(); // Restore the displaying image of ColorPickerButton. ColorPickerButton colorPickerButton = sender as ColorPickerButton; colorPickerButton.Image = colorPickerImage; // Restore the background color of ColorPickerButton. colorPickerButton.BackColor = Color.Empty; colorPickerButton.UseVisualStyleBackColor = true; }
Private Sub ColorPickerButton_EndPickColor(ByVal sender As Object, ByVal e As EndPickColorEventArgs) ' Add the color into listBox1 if the picking of color is succussful. If PickColorResult.OK = e.Result Then Dim result As DialogResult = MessageBox.Show("Do you want to add the color into list box ?", "Picking color successful", MessageBoxButtons.YesNo) If DialogResult.Yes = result Then Me.listBox1.Items.Add(e.Color.ToString()) End If End If ' Clear the text. Me.textBox1.Clear() ' Restore the displaying image of ColorPickerButton. Dim colorPickerButton As ColorPickerButton = TryCast(sender, ColorPickerButton) colorPickerButton.Image = colorPickerImage ' Restore the background color of ColorPickerButton. colorPickerButton.BackColor = Color.Empty colorPickerButton.UseVisualStyleBackColor = True End Sub
System.Object
System.EventArgs
GrapeCity.Win.Common.EndPickColorEventArgs
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