There is nothing in this article, mainly someCode;
1: The background code in WPF draws a line similar to an arrow line;
Arrow line
// Fields
Private Double Marrowangle = 0.17453292519943295 ;
Private Double Marrowlengh = 30.0 ;
// Methods
Public Override Geometry create ( Double X1, Double Y1, Double X2, Double Y2)
{
Point point = New Point (x1, Y1 );
Point point2 = New Point (X2, Y2 );
Double Num = Math. atan (Y2 - Y1) / (X2 - X1 ));
Double D = Num - This . Arrowangle;
Double Num3 = Num + This . Arrowangle;
Int Num4 = (X2 > X1) ? - 1 : 1 ;
Double X = X2 + (Num4 * This . Arrowlengh) * Math. Cos (d ));
Double Y = Y2 + (Num4 * This . Arrowlengh) * Math. Sin (d ));
Double Num7 = X2 + (Num4 * This . Arrowlengh) * Math. Cos (num3 ));
Double Num8 = Y2 + (Num4 * This . Arrowlengh) * Math. Sin (num3 ));
Point point3 = New Point (x, y );
Point point4 = New Point (num7, num8 );
Pathgeometry Geometry = New Pathgeometry ();
Pathfigure figure = New Pathfigure ();
Figure. isfilled = True ;
Figure. startpoint = Point2;
Point [] points = New Point [] {point, point2, point3, point4, point2}; // from point2 to point, return to point2, and draw an arrow. And from point2 to point3 to point4 to point2 .....
Polylinesegment segment = New Polylinesegment (points, True );
Figure. segments. Add (segment );
Geometry. Figures. Add (figure );
Geometry. Freeze ();
Return Geometry;
}
// Properties
Public Double Arrowangle
{
Get
{
Return This . Marrowangle;
}
Set
{
This . Marrowangle = Value;
}
}
Public Double Arrowlengh
{
Get
{
Return This . Marrowlengh;
}
Set
{
This . Marrowlengh = Value;
}
}