Solved

Draw Circle in VB

Posted on 2001-08-06
7
1,911 Views
Last Modified: 2008-01-09
I understand that we can draw a circle or other shapes in VB. But, after i studied the Help file on this topic in MSDN i still don't understand the exact method to draw. Does anyone can provide me some guides???
Thanx.
0
Comment
Question by:Kelvsat
7 Comments
 
LVL 6

Expert Comment

by:JonFish85
ID: 6358348
FormName.Circle (X, Y), Radius

used like this:

Me.Circle (Me.ScaleWidth \ 2, Me.ScaleHeight \ 2), 500

hope this helps!
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 100 total points
ID: 6358354
Sample:

Option Explicit

Private Sub Form_Load()
    Me.AutoRedraw = True
    Me.Circle (Me.Width / 2, Me.Height / 2), Me.Height / 2 - 500
   
End Sub


Circle Method MSDN entry:
Draws a circle, ellipse, or arc on an object.

Syntax

object.Circle [Step] (x, y), radius, [color, start, end, aspect]

The Circle method syntax has the following object qualifier and parts.

Part     Description
object     Optional.  Object expression that evaluates to an object in the Applies To list.  If object is omitted, the Form with the focus is assumed to be object.
Step     Optional.  Keyword specifying that the center of the circle, ellipse, or arc is relative to the current coordinates given by the CurrentX and CurrentY properties of object.
(x, y)     Required.  Single values indicating the coordinates for the center point of the circle, ellipse, or arc.  The ScaleMode property of object determines the units of measure used.
radius     Required.  Single  value indicating the radius of the circle, ellipse, or arc.  The ScaleMode property of object determines the unit of measure used.
color     Optional.  Long integer value indicating the RGB color of the circle's outline.  If omitted, the value of the ForeColor property is used.  You can use the RGB function or QBColor function to specify the color.
start, end     Optional.  Single-precision values.  When an arc or a partial circle or ellipse is drawn, start and end specify (in radians) the beginning and end positions of the arc.  The range for both is -2 pi radians to 2 pi radians.  The default value for start is 0 radians; the default for end is 2 * pi radians.
aspect     Optional.  Single-precision value indicating the aspect ratio of the circle.  The default value is 1.0, which yields a perfect (non-elliptical) circle on any screen.
Remarks

To fill a circle, set the FillColor and FillStyle properties of the object on which the circle or ellipse is drawn. Only a closed figure can be filled.  Closed figures include circles, ellipses, or pie slices (arcs with radius lines drawn at both ends).
When drawing a partial circle or ellipse, if start is negative, Circle draws a radius to start, and treats the angle as positive; if end is negative, Circle draws a radius to end and treats the angle as positive. The Circle method always draws in a counter-clockwise (positive) direction.

The width of the line used to draw the circle, ellipse, or arc depends on the setting of the DrawWidth property. The way the circle is drawn on the background depends on the setting of the DrawMode and DrawStyle properties.
When drawing pie slices, to draw a radius to angle 0 (giving a horizontal line segment to the right), specify a very small negative value for start, rather than zero.
You can omit an argument in the middle of the syntax, but you must include the argument's comma before including the next argument. If you omit an optional argument, omit the comma following the last argument you specify.

When Circle executes, the CurrentX and CurrentY properties are set to the center point specified by the arguments.
This method cannot be used in an With?End With block.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6360314
Why not just add a Shape object, and set its Shape property to 3 (circle)?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 38

Expert Comment

by:PaulHews
ID: 6391385
Kelvsat, what more information do you need at this time?  Please maintain the questions you ask.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6967115
Hi, are you still alive?
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7037486
Please, return to this question to PAQ, award points or post some feedback.
If you have problems with this, ask community support:
http://www.experts-exchange.com/commspt/
Cheers
0
 

Author Comment

by:Kelvsat
ID: 7082817
sorry for very late reply..
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now