TextureBrush Constructor (Image^)
.NET Framework (current version)
Initializes a new TextureBrush object that uses the specified image.
Assembly: System.Drawing (in System.Drawing.dll)
Parameters
- bitmap
-
Type:
System.Drawing::Image^
The Image object with which this TextureBrush object fills interiors.
The following code example demonstrates how to obtain a new bitmap using the FromFile method. It also demonstrates a TextureBrush.
This example is designed to be used with Windows Forms. Create a form containing a button named Button2. Paste the code into the form and associate the Button2_Click method with the button's Click event.
private: void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) { try { Bitmap^ image1 = dynamic_cast<Bitmap^>(Image::FromFile( "C:\\Documents and Settings\\" "All Users\\Documents\\My Music\\music.bmp", true )); TextureBrush^ texture = gcnew TextureBrush( image1 ); texture->WrapMode = System::Drawing::Drawing2D::WrapMode::Tile; Graphics^ formGraphics = this->CreateGraphics(); formGraphics->FillEllipse( texture, RectangleF(90.0F,110.0F,100,100) ); delete formGraphics; } catch ( System::IO::FileNotFoundException^ ) { MessageBox::Show( "There was an error opening the bitmap." "Please check the path." ); } }
.NET Framework
Available since 1.1
Available since 1.1
Show: