ColorDialog.CustomColors 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定對話方塊中顯示的自訂色彩集。
public:
property cli::array <int> ^ CustomColors { cli::array <int> ^ get(); void set(cli::array <int> ^ value); };
[System.ComponentModel.Browsable(false)]
public int[] CustomColors { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.CustomColors : int[] with get, set
Public Property CustomColors As Integer()
屬性值
- Int32[]
對話方塊中顯示的自訂色彩集。 預設值是 null
。
- 屬性
範例
下列程式碼範例示範如何將型 Int32 別的陣列新增至 CustomColors 。 此範例要求程式碼是從 內 Form 執行。
System::Windows::Forms::ColorDialog^ MyDialog = gcnew ColorDialog;
// Allows the user to select or edit a custom color.
MyDialog->AllowFullOpen = true;
// Assigns an array of custom colors to the CustomColors property
array<int>^temp0 = {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;
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;
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
備註
使用者可以建立自己的一組自訂色彩。 這些色彩包含在 Int32 BGR (藍色、綠色、紅色) 建立色彩所需的值中。 如需此資料結構的詳細資訊,請參閱 Color 。
只有在 設定為 true
時 AllowFullOpen ,才能定義自訂色彩。