VB projects - Shapes
Description: Writing the program that draws user-defined shapes on the form
Minimum requirements: vb5
Download: source code
Screenshot:

Project: Standard EXE
Controls: txtHeight (textbox), txtWidth (textbox), cmbStyle (combobox), shp (shape)
Code:
Private Sub cmbStyle_Click()
shp.Shape = cmbStyle.ListIndex
End Sub
Private Sub Form_Load()
cmbStyle.AddItem "Rectangle"
cmbStyle.AddItem "Square"
cmbStyle.AddItem "Oval"
cmbStyle.AddItem "Circle"
cmbStyle.AddItem "Rounded Rectangle"
cmbStyle.AddItem "Rounded Square"
cmbStyle.ListIndex = 0
txtHeight = 500
txtWidth = 500
End Sub
Private Sub txtHeight_Change()
If Val(txtHeight) > 0 Then shp.Height = Val(txtHeight)
End Sub
Private Sub txtWidth_Change()
If Val(txtWidth) > 0 Then shp.Width = Val(txtWidth)
End Sub
|