Search Tools Links Login


Creates a pretty neat geometric design!

Original Author: Haig Demerdjian


The number of lines per side you wish to draw. You would enter it into a text box.


After you enter a number into the text box just click on draw and that's it!


' Before you start anything you should create: 1 picturebox, 1 textbox, 1 command button. Size the picture box so it is pretty big in size and it should be EXACTLY squared so the design looks nice! To do so make sure the scalewidth and scaleheight in the properties section are equal to each other. Now put the following code into the command button.
Private Sub Command1_Click()
If Text1 <= 0 Then Exit Sub
w = Picture1.ScaleWidth / Text1
h = Picture1.ScaleHeight / Text1
' top to left
For draw = 0 To Text1
  Picture1.Line (0 + (w * draw), 0)-(0, Picture1.ScaleHeight - (h * draw))
Next draw
' left to bottom
For draw = 0 To Text1
  Picture1.Line (0, 0 + (h * draw))-(0 + (w * draw), Picture1.ScaleHeight)
Next draw
' bottom to right
For draw = 0 To Text1
  Picture1.Line (0 + (w * draw), Picture1.ScaleHeight)-(Picture1.ScaleWidth, Picture1.ScaleHeight - (h * draw))
Next draw
' right to top
For draw = 0 To Text1
  Picture1.Line (Picture1.ScaleWidth, 0 + (h * draw))-(0 + (w * draw), 0)
Next draw
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 98 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.