PathGradientBrush.RotateTransform Metoda
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Stosuje obrót zgodnie z ruchem wskazówek zegara określonego kąta do lokalnej transformacji geometrycznej.
Przeciążenia
RotateTransform(Single) |
Obraca lokalną transformację geometryczną o określoną kwotę. Ta metoda poprzedza rotację przekształcenia. |
RotateTransform(Single, MatrixOrder) |
Obraca lokalną transformację geometryczną o określoną kwotę w określonej kolejności. |
RotateTransform(Single)
- Źródło:
- PathGradientBrush.cs
- Źródło:
- PathGradientBrush.cs
- Źródło:
- PathGradientBrush.cs
Obraca lokalną transformację geometryczną o określoną kwotę. Ta metoda poprzedza rotację przekształcenia.
public:
void RotateTransform(float angle);
public void RotateTransform (float angle);
member this.RotateTransform : single -> unit
Public Sub RotateTransform (angle As Single)
Parametry
- angle
- Single
Kąt (zakres) obrotu.
Przykłady
Aby zapoznać się z przykładem, zobacz RotateTransform.
Dotyczy
RotateTransform(Single, MatrixOrder)
- Źródło:
- PathGradientBrush.cs
- Źródło:
- PathGradientBrush.cs
- Źródło:
- PathGradientBrush.cs
Obraca lokalną transformację geometryczną o określoną kwotę w określonej kolejności.
public:
void RotateTransform(float angle, System::Drawing::Drawing2D::MatrixOrder order);
public void RotateTransform (float angle, System.Drawing.Drawing2D.MatrixOrder order);
member this.RotateTransform : single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub RotateTransform (angle As Single, order As MatrixOrder)
Parametry
- angle
- Single
Kąt (zakres) obrotu.
- order
- MatrixOrder
Element MatrixOrder określający, czy ma zostać dołączona lub wstępnie utworzona macierz rotacji.
Przykłady
Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgse
OnPaint obiektu zdarzenia . Kod wykonuje następujące akcje:
Tworzy ścieżkę graficzną i dodaje do niego prostokąt.
Tworzy element PathGradientBrush z punktów ścieżki (w tym przykładzie punkty tworzą prostokąt, ale może to być najbardziej dowolny kształt).
Ustawia kolor środkowy na czerwony i otaczający kolor na niebieski.
Rysuje ekran PathGradientBrush przed zastosowaniem przekształcenia rotacji.
Stosuje przekształcenie obracania do pędzla przy użyciu metody RotateTransform .
Rysuje obrócony pędzl (prostokąt) na ekran.
Zwróć uwagę, że dolny prostokąt jest obracany o 45 stopni w porównaniu z tym, który został narysowany przed tłumaczeniem.
public:
void RotateTransformExample( PaintEventArgs^ e )
{
// Create a graphics path and add an ellipse.
GraphicsPath^ myPath = gcnew GraphicsPath;
Rectangle rect = Rectangle(100,20,100,50);
myPath->AddRectangle( rect );
// Get the path's array of points.
array<PointF>^myPathPointArray = myPath->PathPoints;
// Create a path gradient brush.
PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray );
// Set the color span.
myPGBrush->CenterColor = Color::Red;
array<Color>^ mySurroundColor = {Color::Blue};
myPGBrush->SurroundColors = mySurroundColor;
// Draw the brush to the screen prior to transformation.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 );
// Apply the rotate transform to the brush.
myPGBrush->RotateTransform( 45, MatrixOrder::Append );
// Draw the brush to the screen again after applying the
// transform.
e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 300 );
}
public void RotateTransformExample(PaintEventArgs e)
{
// Create a graphics path and add an ellipse.
GraphicsPath myPath = new GraphicsPath();
Rectangle rect = new Rectangle(100, 20, 100, 50);
myPath.AddRectangle(rect);
// Get the path's array of points.
PointF[] myPathPointArray = myPath.PathPoints;
// Create a path gradient brush.
PathGradientBrush myPGBrush = new
PathGradientBrush(myPathPointArray);
// Set the color span.
myPGBrush.CenterColor = Color.Red;
Color[] mySurroundColor = {Color.Blue};
myPGBrush.SurroundColors = mySurroundColor;
// Draw the brush to the screen prior to transformation.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200);
// Apply the rotate transform to the brush.
myPGBrush.RotateTransform(45, MatrixOrder.Append);
// Draw the brush to the screen again after applying the
// transform.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 300);
}
Public Sub RotateTransformExample(ByVal e As PaintEventArgs)
' Create a graphics path and add a rectangle.
Dim myPath As New GraphicsPath
Dim rect As New Rectangle(100, 20, 100, 50)
myPath.AddRectangle(rect)
' Get the path's array of points.
Dim myPathPointArray As PointF() = myPath.PathPoints
' Create a path gradient brush.
Dim myPGBrush As New PathGradientBrush(myPathPointArray)
' Set the color span.
myPGBrush.CenterColor = Color.Red
Dim mySurroundColor As Color() = {Color.Blue}
myPGBrush.SurroundColors = mySurroundColor
' Draw the brush to the screen prior to transformation.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 200)
' Apply the rotate transform to the brush.
myPGBrush.RotateTransform(45, MatrixOrder.Append)
' Draw the brush to the screen again after applying the
' transform.
e.Graphics.FillRectangle(myPGBrush, 10, 10, 200, 300)
End Sub
Dotyczy
Opinia
https://aka.ms/ContentUserFeedback.
Dostępne już wkrótce: W 2024 r. będziemy stopniowo wycofywać zgłoszenia z serwisu GitHub jako mechanizm przesyłania opinii na temat zawartości i zastępować go nowym systemem opinii. Aby uzyskać więcej informacji, sprawdź:Prześlij i wyświetl opinię dla