Re: VB Circle Method Seems to be Seriously Flawed
From: Randy Birch (rgb_removethis_at_mvps.org)
Date: 01/29/05
- Next message: Rick Rothstein: "Re: Clear Textboxes in a selected TabControl"
- Previous message: Randy Gardner: "VB Circle Method Seems to be Seriously Flawed"
- In reply to: Randy Gardner: "VB Circle Method Seems to be Seriously Flawed"
- Next in thread: Randy Gardner: "Re: VB Circle Method Seems to be Seriously Flawed"
- Reply: Randy Gardner: "Re: VB Circle Method Seems to be Seriously Flawed"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 28 Jan 2005 22:35:26 -0500
Well, it works perfectly when the picture box is made square by setting the
width = height (not the scalewidth/scaleheight.
-- Randy Birch MS MVP Visual Basic http://vbnet.mvps.org/ "Randy Gardner" <RandyGardner@discussions.microsoft.com> wrote in message news:DDC117C0-C528-4D83-8ED2-55657E70473E@microsoft.com... : : 'I am using the Circle Method in a picture box to create cam geometry (Arcs) : : 'I discovered an error in positioning the arc in the Y direction. To : explain the : 'point please open a new project and create a picture box, Picture1, and a : command : 'button, Command1, on Form1. Insert the following code in procedure ::Form_Load : 'and Command1_Click then run. : : 'Clicking the command button moves the center of the circle to different : axis at Radius, R!, distance and demonstrates that when the center is on or : near the Y axis : 'the circumference does not intersect the origin like when it is on the X : axis. Demonstrating the problem in Y. As the radius ,R!, increases the : error increases! : ' : '************* : 'How do I report this problem and get a fix fast?????? : : '************** : Watch out for format distruction of code here! : : 'Form_Load code: : : ' : ' : Form1.WindowState = 2 : Picture1.BackColor = vbWhite : Picture1.AutoRedraw = vbTrue : ' : ' Set Coordinate (0,0) in the center of the picture box. : ' : Picture1.ScaleWidth = 5 : ' : Picture1.ScaleHeight = (Picture1.ScaleWidth / 2) * (Picture1.Height / : Picture1.Width) : ' : Picture1.Scale ((Picture1.ScaleWidth * -1) / 2, : Picture1.ScaleHeight)-(Picture1.ScaleWidth / 2, Picture1.ScaleHeight * -1) : ' : ' Draw Axis at (o,o) : ' : Picture1.Line (1 * -1, 0)-(1, 0), vbBlack : Picture1.Line (0, 1)-(0, 1 * -1), vbBlack : ' : ' : 'END CODE Form : : : 'Command1_Click code: : : ' : ' THE PROBLEM IS AGREVATED BY LARGE DIAMETERS (Try : R! = 50, 100, 500) : ' and the ERROR only exist in the Y direction. : ' : ' When the center of the circle is place the radius distance from the : origin on the : ' axis the circumference should go through (0,0) : ' : ' Move center of circle around the axis (R!, 0); (-R!, 0); (0, R!); (0, -R!) : ' : Static I As Integer : Dim X! : Dim Y! : Dim R! : Dim Pi! : ' : ' : Pi! = 3.141592654 : ' : ' Changing R! changes the Circles Diameter : R! = 50 : ' : Select Case I : ' : Case 0 : X! = R!: Y! = 0: I = 1 : Case 1 : X! = 0: Y! = R! * -1: I = 2 : Case 2 : X! = (R! * -1): Y! = 0: I = 3 : Case 3 : X! = 0: Y! = R!: I = 0 : End Select : ' : ' : ' : ' Clear Picture1 : Picture1.Cls : ' : ' Print X! Y! Values : Picture1.CurrentX = 0.2: Picture1.CurrentY = -0.2 : Picture1.Print " Center X! = "; X!; " "; " Center Y! = "; Y! : ' : ' : ' Draw Axis at (o,o) : Picture1.Line (1 * -1, 0)-(1, 0), vbBlack : Picture1.Line (0, 1)-(0, 1 * -1), vbBlack : ' : ' DRAW CIRCLE : ' object.Circle [Step] (x, y), radius, [color, start, end, aspect] : Picture1.Circle (X!, Y!), R!, vbRed, 2 * Pi! : ' : ' : Picture1.Refresh : ' : ' : 'END CODE Command1 : : : : -- : Thank you, : : Randy
- Next message: Rick Rothstein: "Re: Clear Textboxes in a selected TabControl"
- Previous message: Randy Gardner: "VB Circle Method Seems to be Seriously Flawed"
- In reply to: Randy Gardner: "VB Circle Method Seems to be Seriously Flawed"
- Next in thread: Randy Gardner: "Re: VB Circle Method Seems to be Seriously Flawed"
- Reply: Randy Gardner: "Re: VB Circle Method Seems to be Seriously Flawed"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|