Applying an ImageBrush
You can fill a visual element with an image file taking advantage of the ImageBrush
brush. This object is useful even if you want to fill text with image textures. The following code snippet shows how to apply an ImageBrush
as a button background and as the text foreground color:
Note
In the previous code, the Avatar.jpg file is just a sample picture of me. I suppose you might prefer to replace my face with one of your favorite pictures!
The image is specified by assigning the ImageSource
property with the image’s Uri. The previous code produces the result shown in Figure 33.4 (see the last row).
Figure 33.4 Applying an ...
Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.