Matrix.RotateAt 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
회전을 앞에 추가하여 지정된 지점을 기준으로 이 Matrix에 시계 방향 회전을 적용합니다.
오버로드
RotateAt(Single, PointF) |
회전을 앞에 추가하여 |
RotateAt(Single, PointF, MatrixOrder) |
지정된 순서대로 지정된 지점을 기준으로 이 Matrix에 시계 방향 회전을 적용합니다. |
RotateAt(Single, PointF)
- Source:
- Matrix.cs
- Source:
- Matrix.cs
- Source:
- Matrix.cs
회전을 앞에 추가하여 point
매개 변수에 지정된 지점을 기준으로 이 Matrix에 시계 방향 회전을 적용합니다.
public:
void RotateAt(float angle, System::Drawing::PointF point);
public void RotateAt (float angle, System.Drawing.PointF point);
member this.RotateAt : single * System.Drawing.PointF -> unit
Public Sub RotateAt (angle As Single, point As PointF)
매개 변수
- angle
- Single
회전 각도(도)입니다.
예제
다음 코드 예제를 사용 하 여 보여 줍니다는 Matrix 및 문자열을 Transform 회전 하는 메서드. 이 예제는 Windows Forms 사용하도록 설계되었습니다. 폼을 Create 다음 코드를 붙여넣습니다. DrawVerticalStringFromBottomUp
양식의 Paint 이벤트 처리기에서 메서드를 호출하고 로 PaintEventArgs전달 e
합니다.
private:
void DrawVerticalStringFromBottomUp( PaintEventArgs^ e )
{
// Create the string to draw on the form.
String^ text = "Can you read this?";
// Create a GraphicsPath.
System::Drawing::Drawing2D::GraphicsPath^ path = gcnew System::Drawing::Drawing2D::GraphicsPath;
// Add the string to the path; declare the font, font style, size, and
// vertical format for the string.
path->AddString( text, this->Font->FontFamily, 1, 15, PointF(0.0F,0.0F), gcnew StringFormat( StringFormatFlags::DirectionVertical ) );
// Declare a matrix that will be used to rotate the text.
System::Drawing::Drawing2D::Matrix^ rotateMatrix = gcnew System::Drawing::Drawing2D::Matrix;
// Set the rotation angle and starting point for the text.
rotateMatrix->RotateAt( 180.0F, PointF(10.0F,100.0F) );
// Transform the text with the matrix.
path->Transform(rotateMatrix);
// Set the SmoothingMode to high quality for best readability.
e->Graphics->SmoothingMode = System::Drawing::Drawing2D::SmoothingMode::HighQuality;
// Fill in the path to draw the string.
e->Graphics->FillPath( Brushes::Red, path );
// Dispose of the path.
delete path;
}
public void DrawVerticalStringFromBottomUp(PaintEventArgs e)
{
// Create the string to draw on the form.
string text = "Can you read this?";
// Create a GraphicsPath.
System.Drawing.Drawing2D.GraphicsPath path =
new System.Drawing.Drawing2D.GraphicsPath();
// Add the string to the path; declare the font, font style, size, and
// vertical format for the string.
path.AddString(text, this.Font.FontFamily, 1, 15,
new PointF(0.0F, 0.0F),
new StringFormat(StringFormatFlags.DirectionVertical));
// Declare a matrix that will be used to rotate the text.
System.Drawing.Drawing2D.Matrix rotateMatrix =
new System.Drawing.Drawing2D.Matrix();
// Set the rotation angle and starting point for the text.
rotateMatrix.RotateAt(180.0F, new PointF(10.0F, 100.0F));
// Transform the text with the matrix.
path.Transform(rotateMatrix);
// Set the SmoothingMode to high quality for best readability.
e.Graphics.SmoothingMode =
System.Drawing.Drawing2D.SmoothingMode.HighQuality;
// Fill in the path to draw the string.
e.Graphics.FillPath(Brushes.Red, path);
// Dispose of the path.
path.Dispose();
}
Public Sub DrawVerticalStringFromBottomUp(ByVal e As PaintEventArgs)
' Create the string to draw on the form.
Dim text As String = "Can you read this?"
' Create a GraphicsPath.
Dim path As New System.Drawing.Drawing2D.GraphicsPath
' Add the string to the path; declare the font, font style, size, and
' vertical format for the string.
path.AddString(text, Me.Font.FontFamily, 1, 15, New PointF(0.0F, 0.0F), _
New StringFormat(StringFormatFlags.DirectionVertical))
' Declare a matrix that will be used to rotate the text.
Dim rotateMatrix As New System.Drawing.Drawing2D.Matrix
' Set the rotation angle and starting point for the text.
rotateMatrix.RotateAt(180.0F, New PointF(10.0F, 100.0F))
' Transform the text with the matrix.
path.Transform(rotateMatrix)
' Set the SmoothingMode to high quality for best readability.
e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
' Fill in the path to draw the string.
e.Graphics.FillPath(Brushes.Red, path)
' Dispose of the path.
path.Dispose()
End Sub
적용 대상
RotateAt(Single, PointF, MatrixOrder)
- Source:
- Matrix.cs
- Source:
- Matrix.cs
- Source:
- Matrix.cs
지정된 순서대로 지정된 지점을 기준으로 이 Matrix에 시계 방향 회전을 적용합니다.
public:
void RotateAt(float angle, System::Drawing::PointF point, System::Drawing::Drawing2D::MatrixOrder order);
public void RotateAt (float angle, System.Drawing.PointF point, System.Drawing.Drawing2D.MatrixOrder order);
member this.RotateAt : single * System.Drawing.PointF * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub RotateAt (angle As Single, point As PointF, order As MatrixOrder)
매개 변수
- angle
- Single
회전 각도(도)입니다.
- order
- MatrixOrder
회전이 적용되는 순서(뒤나 앞에 추가)를 지정하는 MatrixOrder입니다.
예제
다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 개체인 가 Paint 필요합니다PaintEventArgse
. 코드는 다음 작업을 수행합니다.
회전 변환(파란색 사각형)을 적용하기 전에 화면에 사각형을 그립니다.
행렬을 만들고 지정된 지점 주위로 45도 회전합니다.
이 행렬 변환을 사각형에 적용합니다.
변환된 사각형을 화면에 그립니다(빨간색 사각형).
빨간색 사각형이 사각형의 왼쪽 위 모서리를 중심으로 회전되었습니다(회전 지점이 메서드를 RotateAt 지정).
public:
void RotateAtExample( PaintEventArgs^ e )
{
Pen^ myPen = gcnew Pen( Color::Blue,1.0f );
Pen^ myPen2 = gcnew Pen( Color::Red,1.0f );
PointF rotatePoint = PointF(150.0f,50.0f);
// Draw the rectangle to the screen before applying the
// transform.
e->Graphics->DrawRectangle( myPen, 150, 50, 200, 100 );
// Create a matrix and rotate it 45 degrees.
Matrix^ myMatrix = gcnew Matrix;
myMatrix->RotateAt( 45, rotatePoint, MatrixOrder::Append );
// Draw the rectangle to the screen again after applying the
// transform.
e->Graphics->Transform = myMatrix;
e->Graphics->DrawRectangle( myPen2, 150, 50, 200, 100 );
}
public void RotateAtExample(PaintEventArgs e)
{
Pen myPen = new Pen(Color.Blue, 1);
Pen myPen2 = new Pen(Color.Red, 1);
PointF rotatePoint = new PointF(150.0f, 50.0f);
// Draw the rectangle to the screen before applying the
// transform.
e.Graphics.DrawRectangle(myPen, 150, 50, 200, 100);
// Create a matrix and rotate it 45 degrees.
Matrix myMatrix = new Matrix();
myMatrix.RotateAt(45, rotatePoint, MatrixOrder.Append);
// Draw the rectangle to the screen again after applying the
// transform.
e.Graphics.Transform = myMatrix;
e.Graphics.DrawRectangle(myPen2, 150, 50, 200, 100);
}
Public Sub RotateAtExample(ByVal e As PaintEventArgs)
Dim myPen As New Pen(Color.Blue, 1)
Dim myPen2 As New Pen(Color.Red, 1)
Dim rotatePoint As New PointF(150.0F, 50.0F)
' Draw the rectangle to the screen before applying the
' transform.
e.Graphics.DrawRectangle(myPen, 150, 50, 200, 100)
' Create a matrix and rotate it 45 degrees.
Dim myMatrix As New Matrix
myMatrix.RotateAt(45, rotatePoint, MatrixOrder.Append)
' Draw the rectangle to the screen again after applying the
' transform.
e.Graphics.Transform = myMatrix
e.Graphics.DrawRectangle(myPen2, 150, 50, 200, 100)
End Sub
적용 대상
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기