MonthCalendar.ForeColor 속성

정의

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

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

속성 값

Color

컨트롤의 전경 Color입니다. 기본값은 DefaultForeColor 속성 값입니다.

예제

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

   // 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

설명

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

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

상속자 참고

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

적용 대상

추가 정보