Graphics.SmoothingMode Graphics.SmoothingMode Graphics.SmoothingMode Graphics.SmoothingMode Property

정의

Graphics의 렌더링 품질을 가져오거나 설정합니다.Gets or sets the rendering quality for this Graphics.

public:
 property System::Drawing::Drawing2D::SmoothingMode SmoothingMode { System::Drawing::Drawing2D::SmoothingMode get(); void set(System::Drawing::Drawing2D::SmoothingMode value); };
public System.Drawing.Drawing2D.SmoothingMode SmoothingMode { get; set; }
member this.SmoothingMode : System.Drawing.Drawing2D.SmoothingMode with get, set
Public Property SmoothingMode As SmoothingMode

속성 값

예제

다음 메서드 설정의 효과 보여 줍니다.는 DashCap, DashPattern, 및 SmoothingMode 속성입니다.The following method demonstrates the effects of setting the DashCap, DashPattern, and SmoothingMode properties. 예제의 출력은 다음 그림에 표시 됩니다.The output of the example is shown in the following illustration.

다듬기가 적용 하지 않고 사용 하 여 줄입니다. Lines with and without smoothing applied.

이 예제에서는 Windows Forms를 사용 하 여 사용 하도록 설계 되었습니다.This example is designed to be used with Windows Forms. 양식과 호출 코드를 붙여 합니다 ShowPensAndSmoothingMode 폼을 처리 하는 경우 메서드 Paint 이벤트를 전달 e 으로 PaintEventArgs합니다.Paste the code into a form and call the ShowPensAndSmoothingMode method when handling the form's Paint event, passing e as PaintEventArgs.

private:
   void ShowPensAndSmoothingMode( PaintEventArgs^ e )
   {
      // Set the SmoothingMode property to smooth the line.
      e->Graphics->SmoothingMode = System::Drawing::Drawing2D::SmoothingMode::AntiAlias;

      // Create a new Pen object.
      Pen^ greenPen = gcnew Pen( Color::Green );

      // Set the width to 6.
      greenPen->Width = 6.0F;

      // Set the DashCap to round.
      greenPen->DashCap = System::Drawing::Drawing2D::DashCap::Round;

      // Create a custom dash pattern.
      array<Single>^temp0 = {4.0F,2.0F,1.0F,3.0F};
      greenPen->DashPattern = temp0;

      // Draw a line.
      e->Graphics->DrawLine( greenPen, 20.0F, 20.0F, 100.0F, 240.0F );

      // Change the SmoothingMode to none.
      e->Graphics->SmoothingMode = System::Drawing::Drawing2D::SmoothingMode::None;

      // Draw another line.
      e->Graphics->DrawLine( greenPen, 100.0F, 240.0F, 160.0F, 20.0F );

      // Dispose of the custom pen.
      delete greenPen;
   }
private void ShowPensAndSmoothingMode(PaintEventArgs e)
{

    // Set the SmoothingMode property to smooth the line.
    e.Graphics.SmoothingMode = 
        System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

    // Create a new Pen object.
    Pen greenPen = new Pen(Color.Green);

    // Set the width to 6.
    greenPen.Width = 6.0F;

    // Set the DashCap to round.
    greenPen.DashCap = System.Drawing.Drawing2D.DashCap.Round;

    // Create a custom dash pattern.
    greenPen.DashPattern = new float[]{4.0F, 2.0F, 1.0F, 3.0F};

    // Draw a line.
    e.Graphics.DrawLine(greenPen, 20.0F, 20.0F, 100.0F, 240.0F);

    // Change the SmoothingMode to none.
    e.Graphics.SmoothingMode = 
        System.Drawing.Drawing2D.SmoothingMode.None;

    // Draw another line.
    e.Graphics.DrawLine(greenPen, 100.0F, 240.0F, 160.0F, 20.0F);

    // Dispose of the custom pen.
    greenPen.Dispose();
}
Private Sub ShowPensAndSmoothingMode(ByVal e As PaintEventArgs)

    ' Set the SmoothingMode property to smooth the line.
    e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias

    ' Create a new Pen object.
    Dim greenPen As New Pen(Color.Green)

    ' Set the width to 6.
    greenPen.Width = 6.0F

    ' Set the DashCap to round.
    greenPen.DashCap = Drawing2D.DashCap.Round

    ' Create a custom dash pattern.
    greenPen.DashPattern = New Single() {4.0F, 2.0F, 1.0F, 3.0F}

    ' Draw a line.
    e.Graphics.DrawLine(greenPen, 20.0F, 20.0F, 100.0F, 240.0F)

    ' Change the SmoothingMode to none.
    e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.None

    ' Draw another line.
    e.Graphics.DrawLine(greenPen, 100.0F, 240.0F, 160.0F, 20.0F)

    ' Dispose of the custom pen.
    greenPen.Dispose()
End Sub

설명

다듬기 모드 선, 곡선 및 채워진 영역의 가장자리 사용할 다듬기 (앤티앨리어싱) 여부를 지정 합니다.The smoothing mode specifies whether lines, curves, and the edges of filled areas use smoothing (also called antialiasing). 한 가지 예외는 경로 그라데이션 브러시 다듬기 모드를 따르지 않습니다.One exception is that path gradient brushes do not obey the smoothing mode. 영역을 사용 하 여 입력을 PathGradientBrush 동일한 방식으로 (별칭이 지정 됨)에 관계 없이 렌더링 됩니다는 SmoothingMode 속성입니다.Areas filled using a PathGradientBrush are rendered the same way (aliased) regardless of the SmoothingMode property.

적용 대상