Solved…
Private Sub drawShape(width as integer, height as integer, style as integer)
Const c As Single=0.551915024494
Dim fig As New FigureShape
Dim h As Single = height
Dim w As Single = width
Dim r As Single = h/2
Dim r2 As Single=(c*r)
//
zBackImage=New Picture(Width,height)
Dim g As Graphics = zBackImage.Graphics
Dim mask As picture = New Picture(Width,height)
Dim mask_g As graphics = mask.Graphics
Select Case style
Case 0,1 // rectangle
fig.AddLine 0,0,w,0
fig.AddLine w,0,w,h
fig.AddLine w,h,0,h
fig.AddLine 0,h,0,0
Case 2 // rounded
r=Min(20,h/4)
r2=c*r
fig.AddLine w-r,0,r,0
fig.AddCubic(r,0,0,r,r-r2,0,0,r-r2)
fig.AddLine 0,r,0,h-r
fig.AddCubic(0,h-r, r,h, 0,(h-r)+r2,r-r2,h)
fig.AddLine r,h,w-r,h
fig.AddCubic(w-r,h, w,h-r, (w-r)+r2,h,w,h-r+r2)
fig.addline w,h-r,w,r
fig.AddCubic(w,r,w-r,0,w,r-r2,(w-r)+r2,0)
Case 3 // big rounded
fig.AddLine w-r,0,r,0
fig.AddCubic(r,0,0,r,r-r2,0,0,r-r2)
fig.AddCubic(0,r,r,h,0,r+r2,r-r2,h)
fig.AddLine r,h,w-r,h
fig.AddCubic(w-r,h,w,r,(w-r)+r2,h,w,r+r2)
fig.AddCubic(w,r,w-r,0,w,r-r2,(w-r)+r2,0)
Case 4 //big round left
fig.AddLine w,0,r,0
fig.AddCubic(r,0,0,r,r-r2,0,0,r-r2)
fig.AddCubic(0,r,r,h,0,r+r2,r-r2,h)
fig.AddLine r,h,w,h
Case 5 //big round right
fig.AddLine 0,h,w-r,h
fig.AddCubic(w-r,h,w,r,(w-r)+r2,h,w,r+r2)
fig.AddCubic(w,r,w-r,0,w,r-r2,(w-r)+r2,0)
fig.AddLine w-r,0,0,0
Case 6
r=Ceil(h/3)
fig.addline 0,h,0,r
fig.addline 0,r,r,0
fig.addline r,0,w,0
fig.addline w,0,w,h
Case 7
r=Ceil(h/3)
fig.addline 0,h,0,r
fig.addline 0,r,r,0
fig.addline r,0,w,0
fig.addline w,0,w,h
End Select
//
// step 01 - create mask layer
//
mask_g.forecolor=Color.white
mask_g.fillrect 0,0,mask_g.width,mask_g.height
fig.Border = 0
fig.FillColor = Color.black
mask_g.DrawObject(fig,0,0)
g.ForeColor=Color.orange
g.fillrect 0,0,g.Width,g.height
//
// Step 03 - Add Border
//
If style>0 Then
fig.border = 100
fig.BorderWidth = 3
fig.BorderColor = Color.red
fig.fill = 0
g.DrawObject(fig,0,0)
End If
//
zBackImage.ApplyMask mask
End Sub
Draws 7 different closed shapes using FigureShape