An ImageDrawing enables a DrawingBrush to contain images : DrawingBrush « Windows Presentation Foundation « C# / C Sharp






An ImageDrawing enables a DrawingBrush to contain images

An ImageDrawing enables a DrawingBrush to contain images
 
<Window x:Class="Workspace.DockExample"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Workspace" Width="640" Height="480">
        <Button Height="100" Width="100" Margin="15,0,0,0">Click Me
          <Button.Background>
            <DrawingBrush>
              <DrawingBrush.Drawing>
                <DrawingGroup>
                  <DrawingGroup.Children>
                    <GeometryDrawing Brush="Pink">
                      <GeometryDrawing.Geometry>
                        <RectangleGeometry Rect="0,0,100,100" />
                      </GeometryDrawing.Geometry>
                    </GeometryDrawing>
                    <ImageDrawing ImageSource="c:\image.jpg" Rect="50,50,50,50" />
                    <ImageDrawing ImageSource="c:\image.jpg" Rect="0,0,50,50" />                      
                  </DrawingGroup.Children>
                </DrawingGroup>
              </DrawingBrush.Drawing>
            </DrawingBrush>
          </Button.Background>
        </Button>

</Window>

   
  








Related examples in the same category

1.Using a DrawingBrush as an Opacity MaskUsing a DrawingBrush as an Opacity Mask
2.DrawingBrush and DrawingGroupDrawingBrush and DrawingGroup
3.DrawingBrush.Transform SkewTransformDrawingBrush.Transform SkewTransform
4.DrawingBrush.RelativeTransform RotateTransformDrawingBrush.RelativeTransform RotateTransform
5.Opacity Mask from DrawingOpacity Mask from Drawing
6.A DrawingBrush paints an area with a drawingA DrawingBrush paints an area with a drawing
7.Patterns defined by the DrawingBrush expand to fill the area of the rectanglePatterns defined by the DrawingBrush expand to fill the area of the rectangle
8.Non-tiled Drawingrush examplesNon-tiled Drawingrush examples
9.Tiled DrawingBrush examplesTiled DrawingBrush examples