Hi,
i am having trouble getting my circle centered. When i run my program it draws the circle waaay in the upper left hand corner of my window so i can't even see a circle.
How can i get it to draw around a specified origin? I have this so far.
i have a feeling the circle is being draw outside my field of view. But how can i get it so the center of the circle is somewhere on the form where i can see the whole circle?
I am using the midpoint circle algorithm.
thanks!Code:Option Explicit Dim radius As Integer Dim midpoint As Integer Dim x, y, d As Integer Private Sub cmdDrawCircle_Click() radius = InputBox("Please enter the radius of the circle") Call MidPointcircle End Sub Private Sub CirclePoints() PSet (x, y) PSet (y, x) PSet (y, -x) PSet (x, -y) PSet (-x, -y) PSet (-y, -x) PSet (-y, x) PSet (-x, y) End Sub Private Sub MidPointcircle() x = 0 y = radius d = 1 - radius Call CirclePoints Do While y > x If d < 0 Then d = d + x * 2 + 3 x = x + 1 Else d = d + (x - y) * 2 + 5 x = x + 1 y = y - 1 End If Call CirclePoints Loop End Sub Private Sub Form_Load() DrawWidth = 1 End Sub




Reply With Quote