Yes, floodfill shows that problem, but it is working with fractional starting points.
Below is almost all my code. The disputed part is right up front in the Form_Load proc. Which paints a ring on 2 3000x3000 twip pictureboxes. Pic1, the left, works for positioning(centered), origin location(center), and fills. Pic2 doesn’t work quite right. The ring displays at 2x the size (my earlier comment of 4x was wrong) , its origin is at the upperleft corner, and fill works. I tried both -100, -100 and 100, 100 for the Viewportorg statement. It seemed to have no effect.
.
Dim SideNum As Integer 'counts from 1 to sides as we go around ring
Private Sub Form_Load()
Me.Show
Pic1.ScaleMode = vbInches
size = 5
Pic1.ScaleWidth = size
Pic1.ScaleHeight = size
DrawRing Pic1, PointOf(2.5, 2.5), 12, 2, 1.5
fill Pic1, PointOf(2.5, 2.5), RGB(255, 255, 0)
fill Pic1, PointOf(-2.3, -2.3), RGB(0, 0, 255)
Pic2.ScaleMode = vbInches
SetMapMode Pic2.hDC, MM_ISOTROPIC
SetWindowExtEx Pic2.hDC, 1, 1, Null
SetViewportExtEx Pic2.hDC, GetDeviceCaps(Pic2.hDC, LOGPIXELSX), -GetDeviceCaps(Pic2.hDC,LOGPIXELSY), Null
SetViewportOrgEx hDC, -100, -100, Null
DrawRing Pic2, PointOf(0, 0), 12, 2, 1.5
fill Pic2, PointOf(0, 0), RGB(255, 255, 0)
End Sub
Private Sub DrawRing(dest As PictureBox, Origin As ObjPt, Sides As Integer, Radius As Single, Wall As Single)
Dim SO1 As ObjPt 'gap adjusted segment outer previous
Dim SO2 As ObjPt 'gap adjusted segment outer current
Dim SI1 As ObjPt 'gap adjusted segment inner previous
Dim SI2 As ObjPt 'gap adjusted segment inner current
Dim Ctr As ObjPt
Dim Angle As Single 'current Angle
Dim InitialAngle As Single 'first angle in loop to display ring
Dim Miter As Single
InitialAngle = 0
FinalAngle = 360
SideNum = 0
Miter = 180 / Max(Sides, 1) 'Get apparent Cutting Angle
While Angle <= FinalAngle 'loop around the circle to create segments
SideNum = SideNum + 1
PolarToCartesian Origin, Radius, Angle - 2 * Miter, SO1 'get X,Y of prior outer corner
PolarToCartesian Origin, Radius - Wall, Angle - 2 * Miter, SI1 'get X,Y of prior inner corner
PolarToCartesian Origin, Radius, Angle, SO2 'get X,Y of current outer corner
PolarToCartesian Origin, Radius - Wall, Angle, SI2 'get X,Y of current inner corner
DrawLineObj dest, "lft", SI1, SO1, 0 'first inter-segment boundary
DrawLineObj dest, "out", SO1, SO2, 0 'outer edge
DrawLineObj dest, "inr", SI1, SI2, 0 'inner edge
DrawLineObj dest, "rgt", SI2, SO2, 0 'final inter-segment boundary
CtrPoint SI1, SO1, SI2, SO2, Ctr
fill dest, Ctr, RGB(255 - 10 * SideNum, 0, 0)
Angle = Angle + 2 * Miter 'advance to next segment in the circle/riing
Wend
End Sub
Private Sub fill(dest As PictureBox, Ctr As ObjPt, Color As Long)
Dim p As ObjPt
Dim rtn As Long
dest.FillStyle = cSolid
dest.fillcolor = Color 'set fill style and color
ScaleToPixelsObj dest, Ctr, p
rtn = ExtFloodFill(dest.hDC, p.X, p.y, 0, FLOODFILLBORDER) 'do the fill
End Sub
Private Sub ScaleToPixelsObj(Pic As PictureBox, FromObj As ObjPt, ToObj As ObjPt)
With FromObj
ToObj.X = Pic.ScaleX(.X, Pic.ScaleMode, vbPixels)
ToObj.y = Pic.ScaleY(.y, Pic.ScaleMode, vbPixels)
End With
End Sub
Private Function PointOf(X As Single, y As Single) As ObjPt
Dim ans As ObjPt
ans.X = X
ans.y = y
PointOf = ans
End Function