Created
October 24, 2012 20:34
-
-
Save tecnocrata/3948699 to your computer and use it in GitHub Desktop.
Creating a cross on a grid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void CreateSymbolX(Grid board) | |
| { | |
| var geometry = new PathGeometry { Figures = new PathFigureCollection() }; | |
| var line1 = new PathFigure | |
| { | |
| Segments = new PathSegmentCollection { new LineSegment { Point = new Point(25, 25) } }, | |
| StartPoint = new Point(0, 0) | |
| }; | |
| var line2 = new PathFigure | |
| { | |
| Segments = new PathSegmentCollection { new LineSegment { Point = new Point(25, 0) } }, | |
| StartPoint = new Point(0, 25) | |
| }; | |
| geometry.Figures.Add(line1); | |
| geometry.Figures.Add(line2); | |
| Path X = new Path() | |
| { | |
| Stroke = new SolidColorBrush(Colors.Red), | |
| StrokeThickness = 10, | |
| UseLayoutRounding = false, | |
| Data = geometry, | |
| VerticalAlignment = VerticalAlignment.Center, | |
| HorizontalAlignment = HorizontalAlignment.Center | |
| }; | |
| Grid.SetRow(X, 0); | |
| Grid.SetColumn(X, 0); | |
| board.Children.Add(X); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment