|
-
Jan 5th, 2002, 05:10 PM
#1
Thread Starter
Addicted Member
Annoying problem
I am trying to load an image into the screen using api, and no picture box controls...I have the following code:
VB Code:
Private Sub Form_Activate()
'Create dc device
BackDC = CreateCompatibleDC(Me.hdc)
'Load Image into dc
BackIM = LoadImage(0, App.Path & "\back.bmp", 0, 0, 0, &H10)
'Associate dc with loaded image
SelectObject BackDC, BackIM
'Draw image
BitBlt Me.hdc, 10, 10, 50, 50, BackDC, 0, 0, vbSrcCopy
End Sub
I don't get any error, but the image simply doesn't appear in the screen. I have my form set to pixels, and I've also tried setting the AutoRedraw to true, and add a Form1.cls, but that doesn't work either....
Any idea?
Thanks
-
Jan 5th, 2002, 06:07 PM
#2
Frenzied Member
Try this...
VB Code:
Private Sub Form_Activate()
Dim BackDC As Long
Dim BackIM As Long
Me.AutoRedraw = True
'Create dc device
BackDC = CreateCompatibleDC(Me.hdc)
'Load Image into dc
BackIM = LoadImage(0, "C:\windows\pinstripe.bmp", 0, 0, 0, &H10)
'Associate dc with loaded image
SelectObject BackDC, BackIM
'Draw image
BitBlt Me.hdc, 10, 10, 50, 50, BackDC, 0, 0, vbSrcCopy
Me.Refresh
End Sub
Greg
Free VB Add-In - The Reference Librarian
Click Here for screen shot and download link.
-
Jan 5th, 2002, 06:17 PM
#3
Thread Starter
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|