dear all,
i'm doing a project which involve shape (arc, circles and rectangles) i'm a newbie on VB6, done the easy shapes but problem on drawing the arc on the form to form a half-moon shape. any help or link on this will be great and appreciated. thnx in advance

Recommended Answers

All 10 Replies

syntax to draw circle, arc etc
-----------------------------------------
OBJECT.CIRCLE [STEP](X,Y),RADIUS,[COLOR,START,END,[ASPECT]]]
--
STEP-IT SPECIFIES THE CENTER OF THE CIRCLE IS RELATIVE TO THE CURRENT COORDINATES GIVEN BY "CURRENTX","CURRENTY"
X,Y-INDICATES THE CENTER COORDINATE OF THE CIRCLE.
RADIUS-INDICATES THE RADIUS.
START,END-WHEN AN ARK OR A PARTIAL CIRCLE IS DRAWN START AND END SPECIFIES THE BEGINNING AND THE END POSITION OF THE ARC.
THE RANGE FOR BOTH IS -2Pi RADIAN TO +2 Pi RADIAN.THE DEFAULT VALUE FOR START IS 0 RADIANS AND THAT FOR END IS 2*Pi RADIANS.
ASPECT-INDICATES THE ASPECT RATIO OF THE CIRCLE.DEFAULT IS 1.0 WHICH YIELDS A PERFECT CIRCLE ON ANY SCREEN.

Hope this solves your problem.

hi. thanks for your help. i was able to create the arc but how to make it appear without the click? I want the shape to appear immediately upon loading but it only comes out when i click. I know this is easy stuff for you guys, but as i have mentioned earlier, i'm a newbie, please bear with me. thanks in advance.

put the code in form paint event

try this

Private Sub Form_Paint()
Me.Circle (ScaleWidth / 2, ScaleHeight / 2), Switch(ScaleWidth >= ScaleHeight, ScaleHeight / 2, ScaleWidth < ScaleHeight, ScaleWidth / 2), vbRed, 0, 3, 0.8
End Sub

hey i got this rit but.how can i get that arc colored. means i want that arc filed with color...
thanx in advance

add these two lines to existing code.

Me.FillStyle = vbFSSolid
Me.FillColor = vbRed

add prior to circle code.

hey it din worked out.....getting the same output.

try changing the Scalemode to Twips.

try changing the Scalemode to Twips.

sorry i m not able 2 understand. twips?
help plz.i m stuck!
thanx in advance.

Twips --- is the unit.

I know this has been dead for awhile but this is an answer to the above question, so it kind of needs to go here.

In order to fill an arc with color you must enclose it by drawing the radii as well as the arc. The area inside an open arc will always be the same color as the object on which it is sited, so the arc must be enclosed if the color needs to be different. The only changes needed in the above code to make it work are to change the start and end point values to negative numbers. A negative sign in front of the start and end points tells VB6 to draw the radii as well as the curve so that you have an enclosed arc. The one caveat here is that a negative zero won't work, so a zero needs to be expressed as a very small decimal such as 0.0001 in order to have a minus sign in front of it. The altered code to draw an enclosed arc filled with red is below. I hope this helps someone.

Me.FillStyle = vbFSSolid
Me.FillColor = vbRed
Me.Circle (ScaleWidth / 2, ScaleHeight / 2), Switch(ScaleWidth >= ScaleHeight, ScaleHeight / 2, ScaleWidth < ScaleHeight, ScaleWidth / 2), vbRed, -0.0001, -3, 0.8

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.