TextureBrush.Clone Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates an exact copy of this TextureBrush object.
public:
override System::Object ^ Clone();
public override object Clone ();
override this.Clone : unit -> obj
Public Overrides Function Clone () As Object
Returns
The TextureBrush object this method creates, cast as an Object object.
Examples
The following example is designed for use with Windows Forms, and it requires PaintEventArgs e
, which is a parameter of the Paint
event handler. The code creates a TextureBrush object and an exact copy of that texture brush, and then uses the copy to fill a rectangle on the screen.
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
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기