Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleUse an array of StdPicture objects to hold images without using a control
DescriptionThis example shows how to use an array of StdPicture objects to hold images without using a control in Visual Basic 6.
KeywordsStdPicture, picture, image
CategoriesControls, 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
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated