Geometry Used with a DrawingBrush : Geometry « Windows Presentation Foundation « C# / C Sharp






Geometry Used with a DrawingBrush

    
<Window  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="SDKSample.SampleViewer"
    Title="  Examples" >

   <Canvas> 
        <Rectangle Height="200" Width="200" Stroke="Black" StrokeThickness="1"
          HorizontalAlignment="Left">
          <Rectangle.Fill>
            <DrawingBrush Viewbox="0,0,200,200" ViewboxUnits="Absolute">
              <DrawingBrush.Drawing>
                <GeometryDrawing Brush="#CCCCFF">
                  <GeometryDrawing.Pen>
                    <Pen Thickness="1" Brush="Black" />
                  </GeometryDrawing.Pen>
                  <GeometryDrawing.Geometry>
                    <GeometryGroup>
                      <RectangleGeometry Rect="50,5 100,10" />
                      <RectangleGeometry Rect="50,175 100,10" />
                      <PathGeometry>
                        <PathGeometry.Figures>
                          <PathFigureCollection>
                            <PathFigure IsClosed="true" StartPoint="50,50">
                              <PathFigure.Segments>
                                <PathSegmentCollection>
                                  <BezierSegment Point1="175,300" Point2="625,100" Point3="150,50"/>
                                  <BezierSegment Point1="275,300" Point2="725,100" Point3="250,50"/>
                                  <BezierSegment Point1="375,300" Point2="825,100" Point3="350,50"/>
                                  <BezierSegment Point1="475,300" Point2="925,100" Point3="450,50"/>
                                  <BezierSegment Point1="575,300" Point2="125,100" Point3="550,50"/>
                                  <BezierSegment Point1="625,300" Point2="115,100" Point3="50,50"/>
                                </PathSegmentCollection>
                              </PathFigure.Segments>
                            </PathFigure>
                          </PathFigureCollection>
                        </PathGeometry.Figures>
                      </PathGeometry>               
                    </GeometryGroup>                  
                  </GeometryDrawing.Geometry>
                </GeometryDrawing>
              </DrawingBrush.Drawing>
            </DrawingBrush>
          </Rectangle.Fill>
        </Rectangle>
   </Canvas> 


</Window>

   
    
    
    
  








Related examples in the same category

1.LineGeometryLineGeometry
2.EllipseGeometry
3.RectangleGeometryRectangleGeometry
4.Animate GeometryDrawing ExamplesAnimate GeometryDrawing Examples
5.CombinedGeometry for Path.Data and DrawingBrush for Path.FillCombinedGeometry for Path.Data and DrawingBrush for Path.Fill
6.Combines two geometries using the XOR combine modeCombines two geometries using the XOR combine mode
7.Combines two geometries using the union combine modeCombines two geometries using the union combine mode
8.Combines two geometries using the exclude combine modeCombines two geometries using the exclude combine mode
9.Geometry Transform for RectangleGeometry Transform for Rectangle
10.Geometry Transform for PathGeometry Transform for Path
11.Geometry Used as a Clip
12.Tiled Geometry
13.Ellipse Geometry DemoEllipse Geometry Demo
14.LineGeometry DemoLineGeometry Demo
15.Use PolyBezierSegment to Simulated CircleUse PolyBezierSegment to Simulated Circle
16.Converting text to geometryConverting text to geometry
17.Use a PathGeometry object to highlight displayed text.Use a PathGeometry object to highlight displayed text.