LinearGradientBrush.TranslateTransform Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Yerel geometrik dönüşümü belirtilen boyutlara çevirir. Bu yöntem, çeviriyi dönüştürmeye ekler.
Aşırı Yüklemeler
TranslateTransform(Single, Single, MatrixOrder) |
Yerel geometrik dönüşümü belirtilen sırada belirtilen boyutlara çevirir. |
TranslateTransform(Single, Single) |
Yerel geometrik dönüşümü belirtilen boyutlara çevirir. Bu yöntem, çeviriyi dönüştürmeye ekler. |
TranslateTransform(Single, Single, MatrixOrder)
- Kaynak:
- LinearGradientBrush.cs
- Kaynak:
- LinearGradientBrush.cs
- Kaynak:
- LinearGradientBrush.cs
Yerel geometrik dönüşümü belirtilen sırada belirtilen boyutlara çevirir.
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)
Parametreler
- dx
- Single
x içindeki çevirinin değeri.
- dy
- Single
Çevirinin y içindeki değeri.
- order
- MatrixOrder
Çevirinin uygulanacağı sıra (ek veya ek).
Örnekler
Aşağıdaki kod örneği, Windows Forms ile kullanılmak üzere tasarlanmıştır ve bir OnPaint olay nesnesi gerektirir.PaintEventArgse
Kod aşağıdaki eylemleri gerçekleştirir:
Yeni bir LinearGradientBrush oluşturur.
Bu fırçayı, renklerin doğrusal, soldan sağa geçişi olan bir dikdörtgeni ekrana çizmek için kullanır.
LinearGradientBrush 90 derece döndürür ve gradyanı ölçeklendirir.
Döndürülmüş ve ölçeklendirilmiş gradyanla dikdörtgeni ekrana çizer.
Dikdörtgeni, yukarıdan aşağıya doğru çalışan doğrusal bir gradyan olacak şekilde çevirir.
Çevrilmiş dikdörtgeni ekrana çizer.
Üstte soldan sağa gradyanı gösteren üç dikdörtgen, döndürülmüş ve ölçeklendirilmiş gradyanı gösteren ortadaki ve son, çevrilmiş gradyanı gösteren altta üç dikdörtgen olduğuna dikkat edin.
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
Şunlara uygulanır
TranslateTransform(Single, Single)
- Kaynak:
- LinearGradientBrush.cs
- Kaynak:
- LinearGradientBrush.cs
- Kaynak:
- LinearGradientBrush.cs
Yerel geometrik dönüşümü belirtilen boyutlara çevirir. Bu yöntem, çeviriyi dönüştürmeye ekler.
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)
Parametreler
- dx
- Single
x içindeki çevirinin değeri.
- dy
- Single
Çevirinin y içindeki değeri.
Örnekler
Örnek için bkz. TranslateTransform
Şunlara uygulanır
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin