Class

PictureBrush


Description

Properties

Name

Type

Read-Only

Shared

Image

Picture

Mode

Modes

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

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.