-
Simple GDI+ not working
Hello,
I'm playing with GDI+(Am completely new to this side of things)
I've been going through MSDN to try and understand it.
The problem.....
I've follwed the MSDN example of displaying an existing bitmap image and i have to admit i'm stumped!
As per the example in MSDN i wrote the following code in the form_load event of my form.
Code:
Dim myBitmap As New Bitmap("C:\pic1.bmp")
Dim g As Graphics = Button1.CreateGraphics
g.DrawImage(myBitmap, 1, 1)
Where pic1.bmp was an image on my c drive and Button1 was a button on the form.
But it doesn't work.
It loads fine however it doesn't display the image is not displayed.
What am i doing wrong?:confused:
-
Hi.
The problem is that the image is actually drawn ok, but the next time the form refreshes the button draws itself normally. That is way it doesn't work in Form_Load. The form will display itself AFTER form load, so the button is redrawn normally.
Try using another event like form_click.