You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1010 B
C#

Create buttons using DrawingImage and GeometryDrawing
<Window x:Class="Chapter05.DrawingImageExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="DrawingImage Example" Height="120" Width="360">
<Button Name="DrawRectangle" Grid.Column="1"
ToolTip="Draw Rectangle" Margin="4">
<Image Width="90" Height="90">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<GeometryDrawing Brush="LightGray">
<GeometryDrawing.Geometry>
<RectangleGeometry Rect="0,16,80,60" />
</GeometryDrawing.Geometry>
<GeometryDrawing.Pen>
<Pen Brush="Blue" Thickness="3" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Button>
</Window>