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 사용하도록 설계되었으며 PaintEventArgs 이벤트 처리기의 매개 변수인 ePaint 필요합니다. 코드는 그리기 표면을 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 일관되지 않은 상태로 유지되는 경우 발생할 수 있습니다.

적용 대상