Every time I call LoadPicture or the property PaintPicture in the sub Form_Load the picture doesn't appear at all. I make trace to find what happen the program go right and read without error and the picture doesn't appear.
Printable View
Every time I call LoadPicture or the property PaintPicture in the sub Form_Load the picture doesn't appear at all. I make trace to find what happen the program go right and read without error and the picture doesn't appear.
Move it to the Form_Paint procedure
use Form Activate
In form load things are not loaded, they are loading ....
I think put into the Form_Paint procedure is better. Since the Form_Activate will only fire when the Form is loaded. But the Form_Paint is a bit different from the
Form_Activate. Whereby, when there is a change in the form windows, the Form_Paint event will be fire.
regards,
Chris
Bobbo,
I wouldn't suggest using LoadPicture in the Form_Paint event, else you will tie up alot of memory. I would do something like this...
Also just to clarify the Form_Activate is fired every time the form regains the focus, not just when the form is loaded.Code:Dim iPic As IPictureDisp
Private Sub Form_Load()
Set iPic = LoadPicture("C:\Windows\Bubbles.bmp") ' Load the picture
End Sub
Private Sub Form_Paint()
Me.PaintPicture iPic, 0, 0 ' Show the picture
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set iPic = Nothing 'free memory
End Sub
Not sure if it'll help, but you may want to set the Form's AutoRedraw property to True.