ダイアログ ボックスに表示されるカスタム カラー セットを取得または設定します。
Public Property CustomColors As Integer ()
[C#]
public int[] CustomColors {get; set;}
[C++]
public: __property int get_CustomColors();public: __property void set_CustomColors(int __gc[]);
[JScript]
public function get CustomColors() : int[];
public function set CustomColors(int[]);
プロパティ値
ダイアログ ボックスに表示されるカスタム カラー セット。既定値は null 参照 (Visual Basic では Nothing) です。
解説
ユーザーは独自のカスタム カラー セットを作成できます。これらの色は、色の作成に必要な ARGB コンポーネント (アルファ、赤、緑、および青) 値で構成される Int32 に格納されます。このデータの構造体の詳細については、 Color のトピックを参照してください。
カスタム カラーは、 AllowFullOpen が true に設定されている場合にだけ定義できます。
使用例
[Visual Basic, C#, C++] カスタム カラーを表す Int32 型の配列を CustomColors に追加する方法の例を次に示します。この例では、コードが Form 内から実行されることを前提にしています。
Dim MyDialog = New ColorDialog()
' Allows the user to select or edit a custom color.
MyDialog.AllowFullOpen = True
' Assigns an array of custom colors to the CustomColors property.
MyDialog.CustomColors = New Integer() {6916092, 15195440, 16107657, 1836924, _
3758726, 12566463, 7526079, 7405793, 6945974, 241502, 2296476, 5130294, _
3102017, 7324121, 14993507, 11730944}
' Allows the user to get help. (The default is false.)
MyDialog.ShowHelp = True
' Sets the initial color select to the current text color,
' so that if the user cancels out, the original color is restored.
MyDialog.Color = Me.BackColor
MyDialog.ShowDialog()
Me.BackColor = MyDialog.Color
[C#]
System.Windows.Forms.ColorDialog MyDialog = new ColorDialog();
// Allows the user to select or edit a custom color.
MyDialog.AllowFullOpen = true ;
// Assigns an array of custom colors to the CustomColors property
MyDialog.CustomColors = new int[]{6916092, 15195440, 16107657, 1836924,
3758726, 12566463, 7526079, 7405793, 6945974, 241502, 2296476, 5130294,
3102017, 7324121, 14993507, 11730944,};
// Allows the user to get help. (The default is false.)
MyDialog.ShowHelp = true ;
// Sets the initial color select to the current text color,
// so that if the user cancels out, the original color is restored.
MyDialog.Color = this.BackColor;
MyDialog.ShowDialog();
this.BackColor = MyDialog.Color;
[C++]
System::Windows::Forms::ColorDialog* MyDialog = new ColorDialog();
// Allows the user to select or edit a custom color.
MyDialog->AllowFullOpen = true ;
// Assigns an array of custom colors to the CustomColors property
int temp0 __gc[] = {6916092, 15195440, 16107657, 1836924,
3758726, 12566463, 7526079, 7405793, 6945974, 241502, 2296476, 5130294,
3102017, 7324121, 14993507, 11730944,};
MyDialog->CustomColors = temp0;
// Allows the user to get help. (The default is false.)
MyDialog->ShowHelp = true ;
// Sets the initial color select to the current text color,
// so that if the user cancels out, the original color is restored.
MyDialog->Color = this->BackColor;
MyDialog->ShowDialog();
this->BackColor = MyDialog->Color;
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
.NET Framework セキュリティ:
-
参照
ColorDialog クラス | ColorDialog メンバ | System.Windows.Forms 名前空間 | AnyColor