I want to draw something like this:
So g.drawroundrect but with a broken/dotted line.
I want to draw something like this:
So g.drawroundrect but with a broken/dotted line.
Need this for Windows too.
I found this in an old post, about to try to tweak it for my needs…
[code]Sub DrawDottedLineWithArrow(g as Graphics, x1 as integer, y1 as Integer, x2 as integer, y2 as integer, Size as double, Col as Color, Alpha as integer)
dim gfx as new GdiPlusGraphics( g.Handle( Graphics.HandleTypeHDC ) )
dim brush as new GdiPlusSolidBrush(new GdiPlusColor( Alpha, col.Red, col.Green, col.Blue ))
dim s as Status
s = gfx.SetSmoothingMode(SmoothingMode.AntiAlias)
dim arrow as GdiPlusAdjustableArrowCap
dim pen as GdiPlusPen
pen = new GdiPlusPen( brush, Size )
s = pen.SetColor( new GdiPlusColor( 255, Col.Red, Col.Green, Col.Blue ) )
arrow = new GdiPlusAdjustableArrowCap( 2+Size2, 2+Size2, true )
s = pen.SetCustomEndCap( arrow )
s = pen.SetDashStyle( DashStyle.Dot)
s = gfx.DrawLine( pen, x1, y1, x2, y2 )
end Sub[/code]
You can also animate this by using a timer with the following code:
if rotatedAnim < 359 then
rotatedAnim=rotatedAnim+1
else
rotatedAnim=0
end if
Canvas1.invalidate
And change
CGContextSetLineDash g.handle( g.HandleTypeCGContextRef ), 0,lengthArray,lengths.Ubound+1
to
CGContextSetLineDash g.handle( g.HandleTypeCGContextRef ), rotatedAnim,lengthArray,lengths.Ubound+1
Cant track down this GDIPLUSGraphics class anywhere.
Thought it was part of the WFS but nada.
Anyone able to help?
Can’t help with the GDIPLUSGraphics class, but this blog post has a dashed roundrect on it:
http://bigdaddysurf.com/blog/?p=519
And this forum post has Dave’s bezier class that works with dashes that might help if you want something more complex:
https://forum.xojo.com/3962-dotted-dashed-bezier-curves/0