Pen.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í.
Gira la transformación geométrica local el ángulo especificado. Este método antepone la rotación a la transformación.
Sobrecargas
RotateTransform(Single, MatrixOrder) |
Gira la transformación geométrica local el ángulo especificado y en el orden especificado. |
RotateTransform(Single) |
Gira la transformación geométrica local el ángulo especificado. Este método antepone la rotación a la transformación. |
RotateTransform(Single, MatrixOrder)
- Source:
- Pen.cs
- Source:
- Pen.cs
- Source:
- Pen.cs
Gira la transformación geométrica local el ángulo especificado 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 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
, que es un parámetro del Paint controlador de eventos. El código realiza las siguientes acciones:
Crea una interfaz Pen.
Escala el lápiz en 2 veces en la dirección del eje X.
Dibuja un rectángulo mediante el lápiz.
Gira el lápiz 90 grados en el sentido de las agujas del reloj.
Dibuja un segundo rectángulo para mostrar la diferencia.
public:
void RotateTransform_Example2( PaintEventArgs^ e )
{
// Create a Pen object.
Pen^ rotatePen = gcnew Pen( Color::Black,5.0f );
// Scale rotatePen by 2X in the x-direction.
rotatePen->ScaleTransform( 2, 1 );
// Draw a rectangle with rotatePen.
e->Graphics->DrawRectangle( rotatePen, 10, 10, 100, 100 );
// Rotate rotatePen 90 degrees clockwise.
rotatePen->RotateTransform( 90, MatrixOrder::Append );
// Draw a second rectangle with rotatePen.
e->Graphics->DrawRectangle( rotatePen, 120, 10, 100, 100 );
}
public void RotateTransform_Example2(PaintEventArgs e)
{
// Create a Pen object.
Pen rotatePen = new Pen(Color.Black, 5);
// Scale rotatePen by 2X in the x-direction.
rotatePen.ScaleTransform(2, 1);
// Draw a rectangle with rotatePen.
e.Graphics.DrawRectangle(rotatePen, 10, 10, 100, 100);
// Rotate rotatePen 90 degrees clockwise.
rotatePen.RotateTransform(90, MatrixOrder.Append);
// Draw a second rectangle with rotatePen.
e.Graphics.DrawRectangle(rotatePen, 120, 10, 100, 100);
}
Public Sub RotateTransform_Example2(ByVal e As PaintEventArgs)
' Create a Pen object.
Dim rotatePen As New Pen(Color.Black, 5)
' Scale rotatePen by 2X in the x-direction.
rotatePen.ScaleTransform(2, 1)
' Draw a rectangle with rotatePen.
e.Graphics.DrawRectangle(rotatePen, 10, 10, 100, 100)
' Rotate rotatePen 90 degrees clockwise.
rotatePen.RotateTransform(90, MatrixOrder.Append)
' Draw a second rectangle with rotatePen.
e.Graphics.DrawRectangle(rotatePen, 120, 10, 100, 100)
End Sub
Comentarios
Dado que la forma de un lápiz es circular, un giro no tiene ningún efecto visible a menos que el lápiz se escale en la dirección del eje X o Y.
Se aplica a
RotateTransform(Single)
- Source:
- Pen.cs
- Source:
- Pen.cs
- Source:
- Pen.cs
Gira la transformación geométrica local el ángulo especificado. 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 de rotación.
Ejemplos
El ejemplo de código siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse
, que es un parámetro del Paint controlador de eventos. El código realiza las siguientes acciones:
Crea una interfaz Pen.
Dibuja un rectángulo mediante el lápiz.
Escala el lápiz en 2 veces en la dirección del eje X.
Gira el lápiz 90 grados en el sentido de las agujas del reloj.
Dibuja un segundo rectángulo para mostrar la diferencia.
public:
void RotateTransform_Example1( PaintEventArgs^ e )
{
// Create a Pen object.
Pen^ rotatePen = gcnew Pen( Color::Black,5.0f );
// Draw a rectangle with rotatePen.
e->Graphics->DrawRectangle( rotatePen, 10, 10, 100, 100 );
// Scale rotatePen by 2X in the x-direction.
rotatePen->ScaleTransform( 2, 1 );
// Rotate rotatePen 90 degrees clockwise.
rotatePen->RotateTransform( 90 );
// Draw a second rectangle with rotatePen.
e->Graphics->DrawRectangle( rotatePen, 140, 10, 100, 100 );
}
public void RotateTransform_Example1(PaintEventArgs e)
{
// Create a Pen object.
Pen rotatePen = new Pen(Color.Black, 5);
// Draw a rectangle with rotatePen.
e.Graphics.DrawRectangle(rotatePen, 10, 10, 100, 100);
// Scale rotatePen by 2X in the x-direction.
rotatePen.ScaleTransform(2, 1);
// Rotate rotatePen 90 degrees clockwise.
rotatePen.RotateTransform(90);
// Draw a second rectangle with rotatePen.
e.Graphics.DrawRectangle(rotatePen, 140, 10, 100, 100);
}
Public Sub RotateTransform_Example1(ByVal e As PaintEventArgs)
' Create a Pen object.
Dim rotatePen As New Pen(Color.Black, 5)
' Draw a rectangle with rotatePen.
e.Graphics.DrawRectangle(rotatePen, 10, 10, 100, 100)
' Scale rotatePen by 2X in the x-direction.
rotatePen.ScaleTransform(2, 1)
' Rotate rotatePen 90 degrees clockwise.
rotatePen.RotateTransform(90)
' Draw a second rectangle with rotatePen.
e.Graphics.DrawRectangle(rotatePen, 140, 10, 100, 100)
End Sub
Comentarios
Dado que la forma de un lápiz es circular, un giro no tiene ningún efecto visible a menos que el lápiz se escale en la dirección del eje X o Y.
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