I have three known positions, and currently I am driving two lines like so:
Line line = new Line
{
StrokeThickness = 3,
Stroke = lineColor,
X1 = MyX,
Y1 = MyY,
X2 = MyX,
Y2 = MiddleY
};
Graph.Children.Add(line);
line = new Line
{
StrokeThickness = 3,
Stroke = lineColor,
X1 = MyX,
Y1 = MiddleY,
X2 = TargetX,
Y2 = TargetY
};
Graph.Children.Add(line);
Here's the result:
So, as you can see, this is almost what I want except that I want it to be more smoothed out, just a little bit.
Now I'm looking for any way I could set three points, set some smooth/curvy level to the middle point and then draw a line with a solid color on it. Much like how I can do this in Photoshop:
Or at least get a similar kind of smoothness.
You want to use a PathFigure, specifically with a set of BezierSegments.
I think you are looking for splines
http://msdn.microsoft.com/en-us/library/554h284b.aspx
Gabe is correct that is from Forms
Under WPF you could try a PolyBezierSegment but it require 4 points. Possible you could put in three points and 1 more to shape it.
<Canvas>
<Path Stroke="Black" StrokeThickness="10">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure StartPoint="100,80">
<PathFigure.Segments>
<PathSegmentCollection>
<PolyBezierSegment Points="90,200 140,200 160,200 180,200 430,190 430,280" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
</Canvas>
This results in the following curve
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With