|
|
Title | Use an array of StdPicture objects to hold images without using a control |
Description | This example shows how to use an array of StdPicture objects to hold images without using a control in Visual Basic 6. |
Keywords | StdPicture, picture, image |
Categories | Controls, Graphics |
|
|
A program can use StdPicture objects to store and manipulate pictures without using a control to hold them. This program loads five pictures into an array of StdPicture objects. When the user clicks an option button, the program copies the selected StdPicture into a PictureBox to display it.
|
|
Private the_pictures() As StdPicture
' Load the picture array.
Private Sub Form_Load()
Dim file_path As String
Dim i As Integer
ReDim the_pictures(1 To 5)
file_path = App.Path
If Right$(file_path, 1) <> "\" Then file_path = _
file_path & "\"
For i = 1 To 5
Set the_pictures(i) = LoadPicture( _
file_path & "picture" & _
Format$(i) & ".bmp")
Next i
End Sub
Private Sub optPicture_Click(Index As Integer)
Picture1.Picture = the_pictures(Index + 1)
End Sub
|
|
|
|
|
|