Making a custom dash style for GMap.Net.WinForm route stroke

72 Views Asked by At

I want to make custom path for each route in my GMap.Net.WinForm Project. How can I do that?

I know there is something like Custom DashStyle. Actually I want to make an arrow from one point to another one.
Is it possible to use it to do that?

 route.Stroke = new Pen(System.Drawing.Color.Red, 3);
 mainRoute.Stroke.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
1

There are 1 best solutions below

2
On BEST ANSWER

You can use an AdjustableArrowCap object to create the EndCap of a dashed line that represents a scalable triangular shape.

The two float values represent the length of the lines that start from the end point of the dash. The bool value specifies whether the shape should be filled.

Assign this object to the CustomEndCap property of your Pen:

var routePen = new Pen(Color.Red, 3) {
    DashStyle = DashStyle.Dash,
    CustomEndCap = new AdjustableArrowCap(3.0f, 3.0f, true)
};

route.Stroke = routePen;