다음을 통해 공유


Graphics.TransformPoints 메서드

정의

현재 세계와 이 Graphics페이지 변환을 사용하여 점 배열을 한 좌표 공간에서 다른 좌표 공간으로 변환합니다.

오버로드

TransformPoints(CoordinateSpace, CoordinateSpace, Point[])

현재 세계와 이 Graphics페이지 변환을 사용하여 점 배열을 한 좌표 공간에서 다른 좌표 공간으로 변환합니다.

TransformPoints(CoordinateSpace, CoordinateSpace, PointF[])

현재 세계와 이 Graphics페이지 변환을 사용하여 점 배열을 한 좌표 공간에서 다른 좌표 공간으로 변환합니다.

TransformPoints(CoordinateSpace, CoordinateSpace, Point[])

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

현재 세계와 이 Graphics페이지 변환을 사용하여 점 배열을 한 좌표 공간에서 다른 좌표 공간으로 변환합니다.

public:
 void TransformPoints(System::Drawing::Drawing2D::CoordinateSpace destSpace, System::Drawing::Drawing2D::CoordinateSpace srcSpace, cli::array <System::Drawing::Point> ^ pts);
public void TransformPoints (System.Drawing.Drawing2D.CoordinateSpace destSpace, System.Drawing.Drawing2D.CoordinateSpace srcSpace, System.Drawing.Point[] pts);
member this.TransformPoints : System.Drawing.Drawing2D.CoordinateSpace * System.Drawing.Drawing2D.CoordinateSpace * System.Drawing.Point[] -> unit
Public Sub TransformPoints (destSpace As CoordinateSpace, srcSpace As CoordinateSpace, pts As Point())

매개 변수

destSpace
CoordinateSpace

대상 좌표 공간을 지정하는 CoordinateSpace 열거형의 멤버입니다.

srcSpace
CoordinateSpace

원본 좌표 공간을 지정하는 CoordinateSpace 열거형의 멤버입니다.

pts
Point[]

변환 지점을 나타내는 Point 구조체의 배열입니다.

예제

다음 코드 예제는 Windows Forms에서 사용하도록 설계되었으며 Paint 이벤트 처리기의 매개 변수인 PaintEventArgse필요합니다. 코드는 다음 작업을 수행합니다.

  • 두 점을 만들고 그 사이에 파란색 선을 그립니다.

  • 세계 변환을 x 방향으로 40, y 방향으로 30으로 변환하도록 설정합니다.

  • 점을 월드 좌표(World)에서 페이지 좌표(Page)로 변환합니다.

  • 세계 변환을 ID로 다시 설정합니다.

  • 변환된 점 사이에 빨간색 선을 그립니다.

결과는 파란색 선과 그 아래에 번역된 빨간색 선입니다.

public:
   void TransformPointsPoint( PaintEventArgs^ e )
   {
      // Create array of two points.
      array<Point>^ points = {Point(0,0),Point(100,50)};

      // Draw line connecting two untransformed points.
      e->Graphics->DrawLine( gcnew Pen( Color::Blue,3.0f ), points[ 0 ], points[ 1 ] );

      // Set world transformation of Graphics object to translate.
      e->Graphics->TranslateTransform( 40, 30 );

      // Transform points in array from world to page coordinates.
      e->Graphics->TransformPoints( CoordinateSpace::Page, CoordinateSpace::World, points );

      // Reset world transformation.
      e->Graphics->ResetTransform();

      // Draw line that connects transformed points.
      e->Graphics->DrawLine( gcnew Pen( Color::Red,3.0f ), points[ 0 ], points[ 1 ] );
   }
private void TransformPointsPoint(PaintEventArgs e)
{

    // Create array of two points.
    Point[] points = { new Point(0, 0), new Point(100, 50) };

    // Draw line connecting two untransformed points.
    e.Graphics.DrawLine(new Pen(Color.Blue, 3), points[0], points[1]);

    // Set world transformation of Graphics object to translate.
    e.Graphics.TranslateTransform(40, 30);

    // Transform points in array from world to page coordinates.
    e.Graphics.TransformPoints(CoordinateSpace.Page, CoordinateSpace.World, points);

    // Reset world transformation.
    e.Graphics.ResetTransform();

    // Draw line that connects transformed points.
    e.Graphics.DrawLine(new Pen(Color.Red, 3), points[0], points[1]);
}
Private Sub TransformPointsPoint(ByVal e As PaintEventArgs)

    ' Create array of two points.
    Dim points As Point() = {New Point(0, 0), New Point(100, 50)}

    ' Draw line connecting two untransformed points.
    e.Graphics.DrawLine(New Pen(Color.Blue, 3), points(0), points(1))

    ' Set world transformation of Graphics object to translate.
    e.Graphics.TranslateTransform(40, 30)

    ' Transform points in array from world to page coordinates.
    e.Graphics.TransformPoints(CoordinateSpace.Page, _
    CoordinateSpace.World, points)

    ' Reset world transformation.
    e.Graphics.ResetTransform()

    ' Draw line that connects transformed points.
    e.Graphics.DrawLine(New Pen(Color.Red, 3), points(0), points(1))
End Sub

적용 대상

TransformPoints(CoordinateSpace, CoordinateSpace, PointF[])

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

현재 세계와 이 Graphics페이지 변환을 사용하여 점 배열을 한 좌표 공간에서 다른 좌표 공간으로 변환합니다.

public:
 void TransformPoints(System::Drawing::Drawing2D::CoordinateSpace destSpace, System::Drawing::Drawing2D::CoordinateSpace srcSpace, cli::array <System::Drawing::PointF> ^ pts);
public void TransformPoints (System.Drawing.Drawing2D.CoordinateSpace destSpace, System.Drawing.Drawing2D.CoordinateSpace srcSpace, System.Drawing.PointF[] pts);
member this.TransformPoints : System.Drawing.Drawing2D.CoordinateSpace * System.Drawing.Drawing2D.CoordinateSpace * System.Drawing.PointF[] -> unit
Public Sub TransformPoints (destSpace As CoordinateSpace, srcSpace As CoordinateSpace, pts As PointF())

매개 변수

destSpace
CoordinateSpace

대상 좌표 공간을 지정하는 CoordinateSpace 열거형의 멤버입니다.

srcSpace
CoordinateSpace

원본 좌표 공간을 지정하는 CoordinateSpace 열거형의 멤버입니다.

pts
PointF[]

변환할 점을 나타내는 PointF 구조체의 배열입니다.

예제

다음 코드 예제는 Windows Forms에서 사용하도록 설계되었으며 Paint 이벤트 처리기의 매개 변수인 PaintEventArgse필요합니다. 코드는 다음 작업을 수행합니다.

  • 두 점을 만들고 그 사이에 파란색 선을 그립니다.

  • 세계 변환을 x 방향으로 40, y 방향으로 30으로 변환하도록 설정합니다.

  • 점을 월드 좌표(World)에서 페이지 좌표(Page)로 변환합니다.

  • 세계 변환을 ID로 재설정하고 변환된 점 사이에 빨간색 선을 그립니다.

결과는 파란색 선과 그 아래에 번역된 빨간색 선입니다.

public:
   void TransformPointsPointF( PaintEventArgs^ e )
   {
      // Create array of two points.
      array<PointF>^ points = {PointF(0.0F,0.0F),PointF(100.0F,50.0F)};

      // Draw line connecting two untransformed points.
      e->Graphics->DrawLine( gcnew Pen( Color::Blue,3.0f ), points[ 0 ], points[ 1 ] );

      // Set world transformation of Graphics object to translate.
      e->Graphics->TranslateTransform( 40.0F, 30.0F );

      // Transform points in array from world to page coordinates.
      e->Graphics->TransformPoints( CoordinateSpace::Page, CoordinateSpace::World, points );

      // Reset world transformation.
      e->Graphics->ResetTransform();

      // Draw line that connects transformed points.
      e->Graphics->DrawLine( gcnew Pen( Color::Red,3.0f ), points[ 0 ], points[ 1 ] );
   }
private void TransformPointsPointF(PaintEventArgs e)
{

    // Create array of two points.
    PointF[] points = { new PointF(0.0F, 0.0F), new PointF(100.0F, 50.0F) };

    // Draw line connecting two untransformed points.
    e.Graphics.DrawLine(new Pen(Color.Blue, 3), points[0], points[1]);

    // Set world transformation of Graphics object to translate.
    e.Graphics.TranslateTransform(40.0F, 30.0F);

    // Transform points in array from world to page coordinates.
    e.Graphics.TransformPoints(CoordinateSpace.Page, CoordinateSpace.World, points);

    // Reset world transformation.
    e.Graphics.ResetTransform();

    // Draw line that connects transformed points.
    e.Graphics.DrawLine(new Pen(Color.Red, 3), points[0], points[1]);
}
Private Sub TransformPointsPointF(ByVal e As PaintEventArgs)

    ' Create array of two points.
    Dim points As PointF() = {New PointF(0.0F, 0.0F), New PointF(100.0F, _
    50.0F)}

    ' Draw line connecting two untransformed points.
    e.Graphics.DrawLine(New Pen(Color.Blue, 3), points(0), points(1))

    ' Set world transformation of Graphics object to translate.
    e.Graphics.TranslateTransform(40.0F, 30.0F)

    ' Transform points in array from world to page coordinates.
    e.Graphics.TransformPoints(CoordinateSpace.Page, _
    CoordinateSpace.World, points)

    ' Reset world transformation.
    e.Graphics.ResetTransform()

    ' Draw line that connects transformed points.
    e.Graphics.DrawLine(New Pen(Color.Red, 3), points(0), points(1))
End Sub

적용 대상