I have been playing with this for a while. I think this is great (Some limitations, but with everyones help it could be a good tool. So here is my change. I hope you like it.
Change (In DrawBars)
grfx.FillRectangle(obBrush, obRect)
grfx.DrawRectangle(Pens.Black, obRect)
To
Dim Radius As Integer = d / 2
Dim gp As GraphicsPath = New GraphicsPath()
If c <= 0 Then
Else
If c < Radius * 2 Then
If c < Radius Then
gp.AddLine(a, b, (a + c), b)
gp.AddLine(a + c, b, a + c, (b + d))
gp.AddLine((a + c), b + d, a, b + d)
gp.AddLine(a, (b + d), a, b)
gp.CloseFigure()
Else
gp.AddLine(a, b, (a + c) - Radius, b)
gp.AddArc((a + c) - Radius, b, Radius, Radius, 270, 90)
gp.AddLine(a + c, b + Radius, a + c, (b + d) - Radius)
gp.AddArc((a + c) - Radius, (b + d) - Radius, Radius, Radius, 0, 90)
gp.AddLine((a + c) - Radius, b + d, a, b + d)
gp.AddLine(a, (b + d) - Radius, a, b)
gp.CloseFigure()
End If
Else
gp.AddLine(a + Radius, b, (a + c) - Radius, b)
gp.AddArc((a + c) - Radius, b, Radius, Radius, 270, 90)
gp.AddLine(a + c, b + Radius, a + c, (b + d) - Radius)
gp.AddArc((a + c) - Radius, (b + d) - Radius, Radius, Radius, 0, 90)
gp.AddLine((a + c) - Radius, b + d, a + Radius, b + d)
gp.AddArc(a, (b + d) - Radius, Radius, Radius, 90, 90)
gp.AddLine(a, (b + d) - Radius, a, b + Radius)
gp.AddArc(a, b, Radius, Radius, 180, 90)
gp.CloseFigure()
End If
End If
grfx.SmoothingMode = SmoothingMode.AntiAlias
grfx.FillPath(obBrush, gp)
grfx.DrawPath(obPen, gp)
|