ColorDialog.SolidColorOnly 속성

정의

대화 상자에서 단색만 선택할 수 있는지를 나타내는 값을 가져오거나 설정합니다.

public:
 virtual property bool SolidColorOnly { bool get(); void set(bool value); };
public virtual bool SolidColorOnly { get; set; }
member this.SolidColorOnly : bool with get, set
Public Overridable Property SolidColorOnly As Boolean

속성 값

사용자가 단색만 선택할 수 있으면 true이고, 그렇지 않으면 false입니다. 기본값은 false입니다.

예제

다음 코드 예제에서는 초기화 하는 방법을 보여 줍니다는 ColorDialog 설정 된 AnyColor, AllowFullOpen 속성입니다. ColorDialog 하지만 사용자 지정 색을 설정 하려면 사용자의 전체 집합을 사용 하는 사용 되지 않는 기본 색 표시 합니다. 설정한 경우 합니다 SolidColorOnly 속성을 false, 256 사용 하 여 시스템에서 다른 색과 혼합 된 색을 표시할 수 또는 작은 색입니다. 또한이 예제에서는 설정 된 ShowHelp 속성 및 처리를 HelpRequest 대화 상자에 대 한 이벤트입니다. 예제를 실행 하려면 호출을 폼에 다음 코드를 붙여 합니다 InitializeColorDialog 폼의 생성자 또는 Load 메서드. 이 예제를 Click 단추의 이벤트 예제에서 정의 된 이벤트 처리기 메서드에 연결 되어 있습니다.

// This method initializes ColorDialog1 to allow any colors, 
// and combination colors on systems with 256 colors or less, 
// but will not allow the user to set custom colors.  The
// dialog will contain the help button.
void InitializeColorDialog()
{
   this->ColorDialog1 = gcnew System::Windows::Forms::ColorDialog;
   this->ColorDialog1->AllowFullOpen = false;
   this->ColorDialog1->AnyColor = true;
   this->ColorDialog1->SolidColorOnly = false;
   this->ColorDialog1->ShowHelp = true;
   
   // Associate the event-handling method with
   // the HelpRequest event.
   this->ColorDialog1->HelpRequest +=
      gcnew System::EventHandler( this, &Form1::ColorDialog1_HelpRequest );
}

// This method opens the dialog and checks the DialogResult value. 
// If the result is OK, the text box's background color will be changed 
// to the user-selected color.
void Button1_Click( System::Object^ sender, System::EventArgs^ e )
{
   ::DialogResult result = ColorDialog1->ShowDialog();
   if ( result == ::DialogResult::OK )
   {
      TextBox1->BackColor = ColorDialog1->Color;
   }
}

// This method is called when the HelpRequest event is raised, 
//which occurs when the user clicks the Help button on the ColorDialog object.
void ColorDialog1_HelpRequest( Object^ sender, System::EventArgs^ e )
{
   MessageBox::Show( "Please select a color by clicking it. " +
      "This will change the BackColor property of the TextBox." );
}
// This method initializes ColorDialog1 to allow any colors, 
// and combination colors on systems with 256 colors or less, 
// but will not allow the user to set custom colors.  The
// dialog will contain the help button.
private void InitializeColorDialog()
{
    this.ColorDialog1 = new System.Windows.Forms.ColorDialog();
    this.ColorDialog1.AllowFullOpen = false;
    this.ColorDialog1.AnyColor = true;
    this.ColorDialog1.SolidColorOnly = false;
    this.ColorDialog1.ShowHelp = true;
    
    // Associate the event-handling method with
    // the HelpRequest event.
    this.ColorDialog1.HelpRequest 
        += new System.EventHandler(ColorDialog1_HelpRequest);
}

// This method opens the dialog and checks the DialogResult value. 
// If the result is OK, the text box's background color will be changed 
// to the user-selected color.
private void Button1_Click(System.Object sender, System.EventArgs e)
{
    DialogResult result = ColorDialog1.ShowDialog();
    if (result.Equals(DialogResult.OK))
    {
        TextBox1.BackColor = ColorDialog1.Color;
    }
}

// This method is called when the HelpRequest event is raised, 
//which occurs when the user clicks the Help button on the ColorDialog object.
private void ColorDialog1_HelpRequest(object sender, System.EventArgs e)
{

    MessageBox.Show("Please select a color by clicking it. "
       + "This will change the BackColor property of the TextBox.");
}
   
   ' This method initializes ColorDialog1 to allow any colors, 
   ' and combination colors on systems with 256 colors or less, 
   ' but will not allow the user to set custom colors.  The
   ' dialog will contain the help button.
   Private Sub InitializeColorDialog()
       Me.ColorDialog1 = New System.Windows.Forms.ColorDialog
       Me.ColorDialog1.AllowFullOpen = False
       Me.ColorDialog1.AnyColor = True
       Me.ColorDialog1.SolidColorOnly = False
       Me.ColorDialog1.ShowHelp = True
   End Sub
 

   ' This method opens the dialog and checks the DialogResult value. 
   ' If the result is OK, the text box's background color will be changed 
   ' to the user-selected color.
   Private Sub Button1_Click(ByVal sender As System.Object,  _
       ByVal e As System.EventArgs) Handles Button1.Click
       Dim result As DialogResult = ColorDialog1.ShowDialog()
       If (result.Equals(DialogResult.OK)) Then
           TextBox1.BackColor = ColorDialog1.Color
       End If
   End Sub

 
   ' This method is called when the HelpRequest event is raised, 
   'which occurs when the user clicks the Help button on the ColorDialog object.
   Private Sub ColorDialog1_HelpRequest(ByVal sender As Object, _ 
       ByVal e As System.EventArgs) Handles ColorDialog1.HelpRequest

       MessageBox.Show("Please select a color by clicking it." _
       & "This will change the BackColor property of the TextBox.")
   End Sub

설명

이 속성은 256 색을 사용 하 여 시스템에 해당 합니다. 이러한 종류의 시스템에서 일부 색에는 다른 복합 합니다.

적용 대상