WrapMode Enum
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.
Specifies how a texture or gradient is tiled when it is smaller than the area being filled.
public enum class WrapMode
public enum WrapMode
type WrapMode =
Public Enum WrapMode
- Inheritance
Name | Value | Description |
---|---|---|
Tile | 0 | Tiles the gradient or texture. |
TileFlipX | 1 | Reverses the texture or gradient horizontally and then tiles the texture or gradient. |
TileFlipY | 2 | Reverses the texture or gradient vertically and then tiles the texture or gradient. |
TileFlipXY | 3 | Reverses the texture or gradient horizontally and vertically and then tiles the texture or gradient. |
Clamp | 4 | The texture or gradient is not tiled. |
The following code example demonstrates how to obtain a new bitmap using the FromFile method. It also demonstrates a TextureBrush and the WrapMode enumeration. 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." );
}
}
private void Button2_Click(System.Object sender, System.EventArgs e)
{
try
{
Bitmap image1 = (Bitmap) Image.FromFile(@"C:\Documents and Settings\" +
@"All Users\Documents\My Music\music.bmp", true);
TextureBrush texture = new TextureBrush(image1);
texture.WrapMode = System.Drawing.Drawing2D.WrapMode.Tile;
Graphics formGraphics = this.CreateGraphics();
formGraphics.FillEllipse(texture,
new RectangleF(90.0F, 110.0F, 100, 100));
formGraphics.Dispose();
}
catch(System.IO.FileNotFoundException)
{
MessageBox.Show("There was an error opening the bitmap." +
"Please check the path.");
}
}
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
Try
Dim image1 As Bitmap = _
CType(Image.FromFile("C:\Documents and Settings\" _
& "All Users\Documents\My Music\music.bmp", True), Bitmap)
Dim texture As New TextureBrush(image1)
texture.WrapMode = Drawing2D.WrapMode.Tile
Dim formGraphics As Graphics = Me.CreateGraphics()
formGraphics.FillEllipse(texture, _
New RectangleF(90.0F, 110.0F, 100, 100))
formGraphics.Dispose()
Catch ex As System.IO.FileNotFoundException
MessageBox.Show("There was an error opening the bitmap." _
& "Please check the path.")
End Try
End Sub
Brushes use this enumeration to determine how shapes are filled. To see examples of the effects the WrapMode enumeration values have on a tiled image, see How to: Tile a Shape with an Image.
منتج | الإصدارات |
---|---|
.NET | 8 (package-provided), 9 (package-provided) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
ملاحظات .NET
.NET هو مشروع مصدر مفتوح. حدد رابطًا لتقديم الملاحظات: