Public Sub DrawDashCircle(pDC As Long, p As POINTAPI, lRadius As Long, crColour As Long, Optional bDashed As Boolean)
Dim nDashLength As Long
Dim lError As Long, lXoffset As Long, lYoffset As Long, nDash As Long
Dim bDashOn As Boolean
nDash = 0: nDashLength = 1
bDashOn = True
'Set starting values
lXoffset = lRadius: lYoffset = 0: lError = -lRadius
If IsMissing(bDashed) Then bDashed = False
Do
If (bDashOn) Then
Call SetPixelV(pDC, p.x + lXoffset, p.y + lYoffset, crColour)
Call SetPixelV(pDC, p.x + lXoffset, p.y - lYoffset, crColour)
Call SetPixelV(pDC, p.x + lYoffset, p.y + lXoffset, crColour)
Call SetPixelV(pDC, p.x + lYoffset, p.y - lXoffset, crColour)
Call SetPixelV(pDC, p.x - lYoffset, p.y + lXoffset, crColour)
Call SetPixelV(pDC, p.x - lYoffset, p.y - lXoffset, crColour)
Call SetPixelV(pDC, p.x - lXoffset, p.y + lYoffset, crColour)
Call SetPixelV(pDC, p.x - lXoffset, p.y - lYoffset, crColour)
End If
'Advance the error term and the constant X axis step
lError = lError + lYoffset
lYoffset = lYoffset + 1
'Check to see if error term has overflowed
lError = lError + lYoffset
If (lError >= 0) Then
lXoffset = lXoffset - 1
lError = lError - lXoffset * 2
End If
nDash = nDash + 1
If (bDashed And (nDash = nDashLength)) Then
nDash = 0
bDashOn = Not bDashOn
End If
Loop While (lYoffset <= lXoffset) 'Continue until halfway point
End Sub
Dim nDashLength As Long
Dim lError As Long, lXoffset As Long, lYoffset As Long, nDash As Long
Dim bDashOn As Boolean
nDash = 0: nDashLength = 1
bDashOn = True
'Set starting values
lXoffset = lRadius: lYoffset = 0: lError = -lRadius
If IsMissing(bDashed) Then bDashed = False
Do
If (bDashOn) Then
Call SetPixelV(pDC, p.x + lXoffset, p.y + lYoffset, crColour)
Call SetPixelV(pDC, p.x + lXoffset, p.y - lYoffset, crColour)
Call SetPixelV(pDC, p.x + lYoffset, p.y + lXoffset, crColour)
Call SetPixelV(pDC, p.x + lYoffset, p.y - lXoffset, crColour)
Call SetPixelV(pDC, p.x - lYoffset, p.y + lXoffset, crColour)
Call SetPixelV(pDC, p.x - lYoffset, p.y - lXoffset, crColour)
Call SetPixelV(pDC, p.x - lXoffset, p.y + lYoffset, crColour)
Call SetPixelV(pDC, p.x - lXoffset, p.y - lYoffset, crColour)
End If
'Advance the error term and the constant X axis step
lError = lError + lYoffset
lYoffset = lYoffset + 1
'Check to see if error term has overflowed
lError = lError + lYoffset
If (lError >= 0) Then
lXoffset = lXoffset - 1
lError = lError - lXoffset * 2
End If
nDash = nDash + 1
If (bDashed And (nDash = nDashLength)) Then
nDash = 0
bDashOn = Not bDashOn
End If
Loop While (lYoffset <= lXoffset) 'Continue until halfway point
End Sub