Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

GeometryDrawing Pen and Geometry

<Window x: Class="Drawing.Drawings"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="Drawings" Height="300" Width="300">   <Window.Resources>     <GeometryDrawing x:Key="Drawing" Brush="Yellow" >       <GeometryDrawing.Pen>         <Pen Brush="Blue" Thickness="3"></Pen>       </GeometryDrawing.Pen>       <GeometryDrawing.Geometry>         <PathGeometry>           <PathFigure IsClosed="True" StartPoint="10,100">             <LineSegment Point="100,100" />             <LineSegment Point="100,50" />           </PathFigure>         </PathGeometry>       </GeometryDrawing.Geometry>     </GeometryDrawing>   </Window.Resources>      <StackPanel Orientation="Horizontal" Margin="5">     <Button Width="30" Height="30">       <Image>         <Image.Source>           <DrawingImage Drawing="{StaticResource Drawing}">                       </DrawingImage>         </Image.Source>       </Image>     </Button>   </StackPanel> </Window>