|
|
Title | Experiment with shapes, colors, and fill styles |
Description | This example shows how to experiment with shapes, colors, and fill styles in Visual Basic 6. |
Keywords | shape, FillColor, BackColor, border color |
Categories | Graphics, Controls |
|
|
Thanks to Greg Doran.
This program uses ListBoxes to let the user select various shape properties. The ListBox event handlers set6 the properties of a Shape control. The following code shows how the program sets the Shape's BackColor.
|
|
'BACK GROUND COLOUR
Private Sub lstBackColor_Click()
Dim i% 'i, to hold the
' Index number
Dim TheColourSelected& 'To hold the
' VBColour
i% = Me.lstBackColor.ListIndex 'Get the ListBox
' Index number
'that was clicked.
' (0....n)
Select Case (i%)
Case 0 'If the ListBox
' Index number was
TheColourSelected& = vbBlack ' 0, then the
' colour is Black
Case 1
TheColourSelected& = vbGreen
Case 2
TheColourSelected& = vbRed
Case 3
TheColourSelected& = vbYellow
Case 4
TheColourSelected& = vbBlue
End Select
Me.shpMain.BackColor = TheColourSelected&
End Sub
|
|
|
|
|
|