Applies a DrawingBrush and DrawingGroup to draw gridlines as a background of a Grid control. : DrawingImage « Windows Presentation Foundation « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » Windows Presentation Foundation » DrawingImageScreenshots 
Applies a DrawingBrush and DrawingGroup to draw gridlines as a background of a Grid control.
Applies a DrawingBrush and DrawingGroup to draw gridlines as a background of a Grid control.
 

<Window x:Class="DrawingBrushGridline"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Drawing Brush - Gridline" Height="300" Width="300">

  <Grid>
    <Grid.Background>
      <DrawingBrush Viewport="0,0,50,50" ViewportUnits="Absolute"
        TileMode="Tile">
        <DrawingBrush.Drawing>
          <DrawingGroup>
            <DrawingGroup.Children>
              <GeometryDrawing Geometry="M0,0 L50,0">
                <GeometryDrawing.Pen>
                  <Pen Thickness="2"
                    Brush="LightGreen" />
                </GeometryDrawing.Pen>
              </GeometryDrawing>
              <GeometryDrawing Geometry="M0,10 L50,10">
                <GeometryDrawing.Pen>
                  <Pen Thickness="1"
                    Brush="LightGreen" />
                </GeometryDrawing.Pen>
              </GeometryDrawing>
              <GeometryDrawing Geometry="M0,20 L50,20">
                <GeometryDrawing.Pen>
                  <Pen Thickness="1"
                    Brush="LightGreen" />
                </GeometryDrawing.Pen>
              </GeometryDrawing>
              <GeometryDrawing Geometry="M0,30 L50,30">
                <GeometryDrawing.Pen>
                  <Pen Thickness="1"
                    Brush="LightGreen" />
                </GeometryDrawing.Pen>
              </GeometryDrawing>
              <GeometryDrawing Geometry="M0,40 L50,40">
                <GeometryDrawing.Pen>
                  <Pen Thickness="1"
                    Brush="LightGreen" />
                </GeometryDrawing.Pen>
              </GeometryDrawing>
              <GeometryDrawing Geometry="M0,0 L0,50">
                <GeometryDrawing.Pen>
                  <Pen Thickness="2"
                    Brush="LightGreen" />
                </GeometryDrawing.Pen>
              </GeometryDrawing>
              <GeometryDrawing Geometry="M10,0 L10,50">
                <GeometryDrawing.Pen>
                  <Pen Thickness="1"
                    Brush="LightGreen" />
                </GeometryDrawing.Pen>
              </GeometryDrawing>
              <GeometryDrawing Geometry="M20,0 L20,50">
                <GeometryDrawing.Pen>
                  <Pen Thickness="1"
                    Brush="LightGreen" />
                </GeometryDrawing.Pen>
              </GeometryDrawing>
              <GeometryDrawing Geometry="M30,0 L30,50">
                <GeometryDrawing.Pen>
                  <Pen Thickness="1"
                    Brush="LightGreen" />
                </GeometryDrawing.Pen>
              </GeometryDrawing>
              <GeometryDrawing Geometry="M40,0 L40,50">
                <GeometryDrawing.Pen>
                  <Pen Thickness="1"
                    Brush="LightGreen" />
                </GeometryDrawing.Pen>
              </GeometryDrawing>
            </DrawingGroup.Children>
          </DrawingGroup>
        </DrawingBrush.Drawing>
      </DrawingBrush>
    </Grid.Background>
  </Grid>
</Window>

   
  
Related examples in the same category
1.Create buttons using DrawingImage and GeometryDrawingCreate buttons using DrawingImage and GeometryDrawing
2.Create buttons using DrawingImage objectsCreate buttons using DrawingImage objects
3.VisualBrush and TileMode
4.Duplicate VisualBrush
5.DrawingBrush Opacity from 1 to 0DrawingBrush Opacity from 1 to 0
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.