Beginner VB

Moderators: None (Apply to moderate this forum)
Number of threads: 1233
Number of posts: 2978

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Loopedy Loop Posted by WannaB on 5 Jun 2002 at 1:51 PM
I am trying to figure out the code to creating an image on a screen using loops. EX: Some emails are sent with pictures of bears, flowers, heart, etc. I want it to include user input. I have the input printing to the screen , but I cannot figure out how the loop is supposed to be coded to create the shape. I want to create a circle using the user's input.
Report
Re: Loopedy Loop Posted by Jomac on 6 Jun 2002 at 7:34 AM
Copy this function into your module and call it passing the prooper values.

Private Sub DrawCircle(ByVal obj As Object, ByVal cx As Single, ByVal cy As Single, ByVal radius As Single, ByVal num_segments As Integer)
Const PI = 3.14159265

Dim X As Single
Dim Y As Single
Dim theta As Single
Dim dtheta As Single
Dim seg As Integer

    dtheta = 2 * PI / num_segments
    obj.CurrentX = cx + radius
    obj.CurrentY = cy
    theta = 0
    For seg = 1 To num_segments
        theta = theta + dtheta
        obj.Line -(cx + radius * Cos(theta), cy + radius * Sin(theta))
    Next seg
End Sub


Regards,
______
Jomac.

Report
Re: Loopedy Loop Posted by WannaB on 6 Jun 2002 at 10:42 PM
OK, here is the problem with my program: I am writing a program that is supposed to print a triangle on the screen from a character that the user inputs. There is also a limit to the number of lines that I want to appear. So far, I can get the character to appear on the screen, but I can't make it continue to the next line with an additional character on each line to form the triangle. Can anyone help me?
Report
Re: Loopedy Loop Posted by Jomac on 7 Jun 2002 at 10:17 AM
: OK, here is the problem with my program: I am writing a program that is supposed to print a triangle on the screen from a character that the user inputs. There is also a limit to the number of lines that I want to appear. So far, I can get the character to appear on the screen, but I can't make it continue to the next line with an additional character on each line to form the triangle. Can anyone help me?
:


Uh-Humm, your previous post asked how to create a CIRCLE.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.