' Use LoadImage to load the picture.
Private Sub LoadWithLoadImage(ByVal pic As PictureBox, _
ByVal file_name As String)
Dim hbm As Long
Dim wid As Long
Dim hgt As Long
' Load the image using LoadImage.
wid = pic.ScaleX(pic.ScaleWidth, pic.ScaleMode, _
vbPixels)
hgt = pic.ScaleY(pic.ScaleHeight, pic.ScaleMode, _
vbPixels)
hbm = LoadImage(ByVal 0&, file_name, _
IMAGE_BITMAP, wid, hgt, &H10)
' Select the image into the PictureBox's device context.
pic.AutoRedraw = True
SelectObject pic.hdc, hbm
' Delete the bitmap.
DeleteObject hbm
End Sub
|