PathGradientBrush.RotateTransform Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Aplica a la transformación geométrica local un giro del ángulo especificado y en el sentido de las agujas del reloj.
Sobrecargas
RotateTransform(Single) |
Gira la transformación geométrica local la cantidad especificada. Este método antepone la rotación a la transformación. |
RotateTransform(Single, MatrixOrder) |
Gira la transformación geométrica local la cantidad especificada y en el orden especificado. |
RotateTransform(Single)
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
Gira la transformación geométrica local la cantidad especificada. Este método antepone la rotación a la transformación.
public:
void RotateTransform(float angle);
public void RotateTransform (float angle);
member this.RotateTransform : single -> unit
Public Sub RotateTransform (angle As Single)
Parámetros
- angle
- Single
Ángulo (extensión) de rotación.
Ejemplos
Para obtener un ejemplo, consulte RotateTransform.
Se aplica a
RotateTransform(Single, MatrixOrder)
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
- Source:
- PathGradientBrush.cs
Gira la transformación geométrica local la cantidad especificada y en el orden especificado.
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)
Parámetros
- angle
- Single
Ángulo (extensión) de rotación.
- order
- MatrixOrder
MatrixOrder que especifica si la matriz de rotación se agrega delante o detrás.
Ejemplos
El ejemplo de código siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse
, un OnPaint objeto de evento. El código realiza las siguientes acciones:
Crea una ruta de acceso de gráficos y le agrega un rectángulo.
Crea un a PathGradientBrush partir de los puntos de ruta de acceso (en este ejemplo, los puntos forman un rectángulo, pero podría ser la mayoría de las formas).
Establece el color central en rojo y el color circundante en azul.
Dibuja en PathGradientBrush la pantalla antes de aplicar la transformación de rotación.
Aplica la transformación de giro al pincel mediante su RotateTransform método .
Dibuja el pincel girado (rectángulo) en la pantalla.
Observe que el rectángulo inferior gira 45 grados en comparación con el dibujado antes de la traducción.
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
Se aplica a
Comentarios
https://aka.ms/ContentUserFeedback.
Próximamente: A lo largo de 2024 iremos eliminando gradualmente GitHub Issues como mecanismo de comentarios sobre el contenido y lo sustituiremos por un nuevo sistema de comentarios. Para más información, vea:Enviar y ver comentarios de