TextureBrush.Clone Methode

Definition

Erstellt eine genaue Kopie dieses TextureBrush Objekts.

public:
 override System::Object ^ Clone();
public override object Clone();
override this.Clone : unit -> obj
Public Overrides Function Clone () As Object

Gibt zurück

Das TextureBrush Objekt, das von dieser Methode erstellt wird, wird als Object Objekt umgegossen.

Beispiele

Das folgende Beispiel wurde für die Verwendung mit Windows Forms entwickelt und erfordert PaintEventArgseeinen Parameter des Paint Ereignishandlers. Der Code erstellt ein TextureBrush Objekt und eine genaue Kopie dieses Texturpinsels und verwendet dann die Kopie, um ein Rechteck auf dem Bildschirm auszufüllen.

public:
   void Clone_Example( PaintEventArgs^ e )
   {
      // Create a TextureBrush object.
      TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) );

      // Create an exact copy of tBrush.
      TextureBrush^ cloneBrush = dynamic_cast<TextureBrush^>(tBrush->Clone());

      // Fill a rectangle with cloneBrush.
      e->Graphics->FillRectangle( cloneBrush, 0, 0, 100, 100 );
   }
public void Clone_Example(PaintEventArgs e)
{
             
    // Create a TextureBrush object.
    TextureBrush tBrush = new TextureBrush(new Bitmap("texture.jpg"));
             
    // Create an exact copy of tBrush.
    TextureBrush cloneBrush = (TextureBrush)tBrush.Clone();
             
    // Fill a rectangle with cloneBrush.
    e.Graphics.FillRectangle(cloneBrush, 0, 0, 100, 100);
}
Public Sub Clone_Example(ByVal e As PaintEventArgs)

    ' Create a TextureBrush object.
    Dim tBrush As New TextureBrush(New Bitmap("texture.jpg"))

    ' Create an exact copy of tBrush.
    Dim cloneBrush As TextureBrush = CType(tBrush.Clone(), _
    TextureBrush)

    ' Fill a rectangle with cloneBrush.
    e.Graphics.FillRectangle(cloneBrush, 0, 0, 100, 100)
End Sub

Gilt für: