LinearGradientBrush.ResetTransform Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Reimposta l'identità della proprietà Transform.
public:
void ResetTransform();
public void ResetTransform ();
member this.ResetTransform : unit -> unit
Public Sub ResetTransform ()
Esempio
L'esempio di codice seguente è progettato per l'uso con Windows Form e richiede PaintEventArgse
, un oggetto evento OnPaint. Il codice esegue le azioni seguenti:
Crea un nuovo LinearGradientBrush.
Disegna un'ellisse sullo schermo usando questo pennello.
Chiama il metodo MultiplyTransform per trasformare il LinearGradientBrush.
Disegna un'ellisse sullo schermo direttamente sotto il primo ellisse, usando il pennello trasformato.
Reimposta la trasformazione.
Disegna un terzo ellisse sullo schermo sotto le prime due.
Si noti che l'ellisse più bassa viene disegnata la stessa dimensione del primo e che, a causa della chiamata al metodo ResetTransform, la sfumatura è stata ridotta per la corrispondenza.
private:
void ResetTransformExample( 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 an ellipse to the screen using the LinearGradientBrush.
e->Graphics->FillEllipse( myLGBrush, myRect );
// Transform the LinearGradientBrush.
array<Point>^ transformArray = {Point(20,150),Point(400,150),Point(20,200)};
Matrix^ myMatrix = gcnew Matrix( myRect,transformArray );
myLGBrush->MultiplyTransform( myMatrix, MatrixOrder::Prepend );
// Draw a second ellipse to the screen
// using the transformed brush.
e->Graphics->FillEllipse( myLGBrush, 20, 150, 380, 50 );
// Reset the brush transform.
myLGBrush->ResetTransform();
// Draw a third ellipse to the screen using the reset brush.
e->Graphics->FillEllipse( myLGBrush, 20, 250, 200, 100 );
}
private void ResetTransformExample(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 an ellipse to the screen using the LinearGradientBrush.
e.Graphics.FillEllipse(myLGBrush, myRect);
// Transform the LinearGradientBrush.
Point[] transformArray = { new Point(20, 150),
new Point(400,150), new Point(20, 200) };
Matrix myMatrix = new Matrix(myRect, transformArray);
myLGBrush.MultiplyTransform( myMatrix, MatrixOrder.Prepend);
// Draw a second ellipse to the screen
// using the transformed brush.
e.Graphics.FillEllipse(myLGBrush, 20, 150, 380, 50);
// Reset the brush transform.
myLGBrush.ResetTransform();
// Draw a third ellipse to the screen using the reset brush.
e.Graphics.FillEllipse(myLGBrush, 20, 250, 200, 100);
}
Public Sub ResetTransformExample(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 an ellipse to the screen using the LinearGradientBrush.
e.Graphics.FillEllipse(myLGBrush, myRect)
' Transform the LinearGradientBrush.
Dim transformArray As Point() = {New Point(20, 150), _
New Point(400, 150), New Point(20, 200)}
Dim myMatrix As New Matrix(myRect, transformArray)
myLGBrush.MultiplyTransform(myMatrix, MatrixOrder.Prepend)
' Draw a second ellipse to the screen using the transformed brush.
e.Graphics.FillEllipse(myLGBrush, 20, 150, 380, 50)
' Reset the brush transform.
myLGBrush.ResetTransform()
' Draw a third ellipse to the screen using the reset brush.
e.Graphics.FillEllipse(myLGBrush, 20, 250, 200, 100)
End Sub