Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Turning random Points to PathFigure.Segment

$
0
0

Hello all,

I have a problem about drawing custom shape with a mouse and then turn those lines to one PathFigure. That is, turn every one of those lines into PathFigure.Segment.

Please look at this video where I show how does my program work:

http://tinypic.com/player.php?v=2e2phua%3E&s=5#.UsrrffTuIrN

So, in the program, I collect those lines' start and end points. So I have info on their position. Now I need to somehow add all those lines like this:

PathFigure pa = new PathFigure();
   pa.StartPoint = new Point(x, y);
   pa.Segments.Add(new LineSegment(new Point(xx,yy),new Point(xx,yy)));
   pa.Segments.Add(new LineSegment(new Point(xx,yy),new Point(xx,yy)));
            ...
            ...

And then, add that to Path and draw it:

PathGeometry geometry = new PathGeometry();
geometry.Figures.Add(pa);

Path path = new Path();
path.Data = geometry;

canvas.Children.Add(path);

That's the way I know it. I need all this because I need to fill it with Image or solid color.  Please suggest anything and please help me on how to solve this. Thank you all !



Knowledge: C, C++, C#, Java, Pawn


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>