Graphics.Clear(Color) 메서드

정의

전체 그리기 화면을 지우고 지정된 배경색으로 화면을 채웁니다.

public:
 void Clear(System::Drawing::Color color);
public void Clear (System.Drawing.Color color);
member this.Clear : System.Drawing.Color -> unit
Public Sub Clear (color As Color)

매개 변수

color
Color

그리기 표면의 배경색입니다.

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 의 Graphics 그리기 표면을 지우고 배경색을 시스템 정의 청록색으로 설정합니다.

private:
   void ClearColor( PaintEventArgs^ e )
   {
      // Clear screen with teal background.
      e->Graphics->Clear( Color::Teal );
   }
private void ClearColor(PaintEventArgs e)
{
    // Clear screen with teal background.
    e.Graphics.Clear(Color.Teal);
}
Private Sub ClearColor(ByVal e As PaintEventArgs)

    ' Clear screen with teal background.
    e.Graphics.Clear(Color.Teal)
End Sub

설명

효과적으로 메서드는 Clear 지정된 색의 단색 브러시로 영역을 채웁니다. 지정된 색의 투명도가 유지됩니다.

이 메서드는 그래픽 개체의 상태를 지우고 그래픽 개체를 업데이트할 수 없는 경우 호출하면 안 됩니다. 예를 들어 메서드가 터미널 서버 세션 ExternalExceptionClear 보안 데스크톱에서 호출되면 가 발생하여 개체가 일관되지 않은 상태로 남을 Graphics 수 있습니다.

적용 대상