MonthCalendar.BackColor 속성

정의

컨트롤의 배경색을 가져오거나 설정합니다.

public:
 virtual property System::Drawing::Color BackColor { System::Drawing::Color get(); void set(System::Drawing::Color value); };
public override System.Drawing.Color BackColor { get; set; }
member this.BackColor : System.Drawing.Color with get, set
Public Overrides Property BackColor As Color

속성 값

Color

컨트롤의 배경색을 나타내는 Color입니다. 기본값은 DefaultBackColor 속성 값입니다.

예제

다음 코드 예제에서는 컨트롤을 BackColor ForeColor 기본 시스템 색으로 설정합니다. 컨트롤에 자식 컨트롤이 있는 경우 코드가 재귀적으로 자신을 호출합니다. 이 코드 예제 Form 에서는 자식 컨트롤이 하나 이상 있어야 합니다. 그러나 자식 컨트롤이 있는 GroupBox자식 컨테이너 컨트롤(예: Panel 자식 컨트롤)은 재귀를 더 잘 보여 줍니다.

   // Reset all the controls to the user's default Control color.
private:
   void ResetAllControlsBackColor( Control^ control )
   {
      control->BackColor = SystemColors::Control;
      control->ForeColor = SystemColors::ControlText;
      if ( control->HasChildren )
      {
         // Recursively call this method for each child control.
         IEnumerator^ myEnum = control->Controls->GetEnumerator();
         while ( myEnum->MoveNext() )
         {
            Control^ childControl = safe_cast<Control^>(myEnum->Current);
            ResetAllControlsBackColor( childControl );
         }
      }
   }
// Reset all the controls to the user's default Control color. 
private void ResetAllControlsBackColor(Control control)
{
   control.BackColor = SystemColors.Control;
   control.ForeColor = SystemColors.ControlText;
   if(control.HasChildren)
   {
      // Recursively call this method for each child control.
      foreach(Control childControl in control.Controls)
      {
         ResetAllControlsBackColor(childControl);
      }
   }
}
' Reset all the controls to the user's default Control color. 
Private Sub ResetAllControlsBackColor(control As Control)
   control.BackColor = SystemColors.Control
   control.ForeColor = SystemColors.ControlText
   If control.HasChildren Then
      ' Recursively call this method for each child control.
      Dim childControl As Control
      For Each childControl In  control.Controls
         ResetAllControlsBackColor(childControl)
      Next childControl
   End If
End Sub

설명

System.Windows.Forms.ControlStyles 이 로 설정되지 않는 한 SupportsTransparentBackColor 속성 BackColor 은 투명한 색을 true지원하지 않습니다.

BackColor 속성은 앰비언트 속성입니다. 앰비언트 속성은 설정되지 않은 경우 부모 컨트롤에서 검색되는 컨트롤 속성입니다. 예를 들어 a는 Button 기본적으로 부모와 Form 동일합니다BackColor. 앰비언트 속성에 대한 자세한 내용은 클래스 또는 클래스 개요를 Control 참조 AmbientProperties 하세요.

Windows Vista부터 테마에 따라 이 속성을 설정해도 일정 모양이 변경되지 않을 수 있습니다. 예를 들어 Windows Aero 테마를 사용하도록 설정된 경우 이 속성을 설정해도 아무런 효과가 없습니다. 이는 업데이트된 버전의 일정이 현재 운영 체제 테마에서 런타임에 파생된 모양으로 렌더링되기 때문입니다. 이 속성을 사용 하 고 달력의 이전 버전을 사용 하도록 설정 하려는 경우에 애플리케이션에 대 한 비주얼 스타일을 비활성화할 수 있습니다. 비주얼 스타일을 사용 하지 않도록 설정 하면 애플리케이션에서 다른 컨트롤의 동작과 모양을 달라질 수 있습니다. Visual Basic 비주얼 스타일을 사용하지 않으려면 Project 디자이너를 열고 XP 시각적 스타일 사용 확인란의 선택을 취소합니다. C#에서 비주얼 스타일을 사용하지 않도록 설정하려면 Program.cs를 열고 주석을 처리 Application.EnableVisualStyles();합니다.

상속자 참고

파생 클래스에서 BackColor 속성을 재정의할 때 기본 클래스의 BackColor 속성을 사용하여 기본 구현을 확장합니다. 그렇지 않으면 모든 구현을 제공해야 합니다. 속성의 접근자와 set 접근자를 모두 get 재정의할 필요는 없습니다. 필요한 경우 하나만 재정의 BackColor 할 수 있습니다.

적용 대상

추가 정보