Class
PictureBrush
Description
Uses the supplied image to draw an area based upon the mode set.
Methods
Name |
Parameters |
Returns |
Shared |
---|---|---|---|
image As Picture, mode As PictureBrush.Modes = PictureBrush.Modes.Default |
Enumerations
PictureBrush.Modes
Modes
The various ways in which the picture can be used as a brush.
Enum |
Description |
---|---|
Default |
The default mode is Pad. |
Pad |
Draws the picture in the upper-left corner then extends the pixels at the right and bottom sides to the right and bottom sides of the graphics area. Not supported for MacOS or iOS. |
Tile |
Repeats the picture over and over in rows and columns. |
Mirror |
Like Tile, except that each image is a horizontal mirror of the previous and alternating rows are vertical mirror of the previous rows. Not supported for MacOS or iOS. |
Property descriptions
PictureBrush.Image
Image As Picture
The Picture to be used as a brush.
PictureBrush.Mode
Mode As Modes
The mode to be used when drawing the Image in the drawing.
Not all modes are supported on all platforms. See the Modes enumeration for details.
Warning
Setting this property to a mode that is not supported on the OS upon which the app is running will result in an UnsupportedFormatException occurring.
In this example, the Mode of the PictureBrush is set to Tile in the Paint event of a Canvas:
Var pb As New PictureBrush
pb.Image = Moon
pb.Mode = PictureBrush.Modes.Tile
Method descriptions
PictureBrush.Constructor
Constructor(image As Picture, mode As PictureBrush.Modes = PictureBrush.Modes.Default)
Creates a PictureBrush from the parameters passed.
Notes
Not all draw modes are supported on all platforms. See the Modes property for details.
Sample code
This example draws a picture (a project item named "Moon") into a rectangle the size of the a Canvas using the Tile mode:
Var pbrush As New PictureBrush
pbrush.Image = Moon
pbrush.Mode = PictureBrush.Modes.Tile
g.Brush = pbrush
g.FillRectangle(0, 0, g.Width, g.Height)
Compatibility
All project types on all supported operating systems.
See also
GraphicsBrush parent class; Graphics, LinearGradientBrush, ShadowBrush, and RadialGradientBrush classes.