LinearGradientBrush.TranslateTransform 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 크기만큼 로컬 기하학적 변환을 이동합니다. 이 메서드는 변환 앞에 이동을 추가합니다.
오버로드
TranslateTransform(Single, Single, MatrixOrder) |
특정 순서로 지정된 크기만큼 로컬 기하학적 변환을 이동합니다. |
TranslateTransform(Single, Single) |
지정된 크기만큼 로컬 기하학적 변환을 이동합니다. 이 메서드는 변환 앞에 이동을 추가합니다. |
TranslateTransform(Single, Single, MatrixOrder)
- Source:
- LinearGradientBrush.cs
- Source:
- LinearGradientBrush.cs
- Source:
- LinearGradientBrush.cs
특정 순서로 지정된 크기만큼 로컬 기하학적 변환을 이동합니다.
public:
void TranslateTransform(float dx, float dy, System::Drawing::Drawing2D::MatrixOrder order);
public void TranslateTransform (float dx, float dy, System.Drawing.Drawing2D.MatrixOrder order);
member this.TranslateTransform : single * single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub TranslateTransform (dx As Single, dy As Single, order As MatrixOrder)
매개 변수
- dx
- Single
X축으로의 이동 값입니다.
- dy
- Single
Y축으로의 이동 값입니다.
- order
- MatrixOrder
이동을 적용할 순서(앞에 추가 또는 뒤에 추가)입니다.
예제
다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 개체인 이 OnPaint 필요합니다PaintEventArgse
. 코드는 다음 작업을 수행합니다.
새 LinearGradientBrush를 만듭니다.
이 브러시를 사용하여 선형의 왼쪽에서 오른쪽으로 색이 전환된 화면에 사각형을 그립니다.
를 LinearGradientBrush 90도 회전하고 그라데이션의 크기를 조정합니다.
회전 및 배율 그라데이션을 사용하여 사각형을 화면에 그립니다.
직사각형을 변환하여 선형 그라데이션이 위에서 아래로 실행되도록 합니다.
번역된 사각형을 화면에 그립니다.
왼쪽에서 오른쪽 그라데이션, 회전 및 배율 그라데이션을 표시하는 가운데 그라데이션, 그리고 마지막 변환된 그라데이션을 표시하는 아래쪽 그라데이션을 보여 주는 세 개의 사각형이 표시됩니다.
private:
void TranslateTransformExample( PaintEventArgs^ e )
{
// Create a LinearGradientBrush.
Rectangle myRect = Rectangle(20,20,200,100);
LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true );
// Draw a rectangle to the screen using the LinearGradientBrush.
e->Graphics->FillRectangle( myLGBrush, myRect );
// Rotate the LinearGradientBrush.
myLGBrush->RotateTransform( 90.0f );
// Scale the gradient for the height of the rectangle.
myLGBrush->ScaleTransform( 0.5f, 1.0f );
// Draw to the screen, the rotated and scaled gradient.
e->Graphics->FillRectangle( myLGBrush, 20, 150, 200, 100 );
// Rejustify the brush to start at the top edge of the
// rectangle.
myLGBrush->TranslateTransform( -20.0f, 0.0f );
// Draw a third rectangle to the screen using the translated
// brush.
e->Graphics->FillRectangle( myLGBrush, 20, 300, 200, 100 );
}
private void TranslateTransformExample(PaintEventArgs e)
{
// Create a LinearGradientBrush.
Rectangle myRect = new Rectangle(20, 20, 200, 100);
LinearGradientBrush myLGBrush = new LinearGradientBrush(
myRect, Color.Blue, Color.Red, 0.0f, true);
// Draw a rectangle to the screen using the LinearGradientBrush.
e.Graphics.FillRectangle(myLGBrush, myRect);
// Rotate the LinearGradientBrush.
myLGBrush.RotateTransform(90.0f);
// Scale the gradient for the height of the rectangle.
myLGBrush.ScaleTransform(0.5f, 1.0f);
// Draw to the screen, the rotated and scaled gradient.
e.Graphics.FillRectangle(myLGBrush, 20, 150, 200, 100);
// Rejustify the brush to start at the top edge of the
// rectangle.
myLGBrush.TranslateTransform(-20.0f, 0.0f);
// Draw a third rectangle to the screen using the translated
// brush.
e.Graphics.FillRectangle(myLGBrush, 20, 300, 200, 100);
}
Public Sub TranslateTransformExample(ByVal e As PaintEventArgs)
' Create a LinearGradientBrush.
Dim myRect As New Rectangle(20, 20, 200, 100)
Dim myLGBrush As New LinearGradientBrush(myRect, Color.Blue, _
Color.Red, 0.0F, True)
' Draw a rectangle to the screen using the LinearGradientBrush.
e.Graphics.FillRectangle(myLGBrush, myRect)
' Rotate the LinearGradientBrush.
myLGBrush.RotateTransform(90.0F)
' Scale the gradient for the height of the rectangle.
myLGBrush.ScaleTransform(0.5F, 1.0F)
' Draw to the screen, the rotated and scaled gradient.
e.Graphics.FillRectangle(myLGBrush, 20, 150, 200, 100)
' Rejustify the brush to start at the top edge of the rectangle.
myLGBrush.TranslateTransform(-20.0F, 0.0F)
' Draw a third rectangle to the screen using the translated brush.
e.Graphics.FillRectangle(myLGBrush, 20, 300, 200, 100)
End Sub
적용 대상
TranslateTransform(Single, Single)
- Source:
- LinearGradientBrush.cs
- Source:
- LinearGradientBrush.cs
- Source:
- LinearGradientBrush.cs
지정된 크기만큼 로컬 기하학적 변환을 이동합니다. 이 메서드는 변환 앞에 이동을 추가합니다.
public:
void TranslateTransform(float dx, float dy);
public void TranslateTransform (float dx, float dy);
member this.TranslateTransform : single * single -> unit
Public Sub TranslateTransform (dx As Single, dy As Single)
매개 변수
- dx
- Single
X축으로의 이동 값입니다.
- dy
- Single
Y축으로의 이동 값입니다.
예제
예제를 보려면 TranslateTransform를 참조하세요.
적용 대상
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기