Re: display image using gdi
I assume you mean GDI+
VB Code:
Me.CreateGraphics.DrawImageUnscaled(Image.FromFile("c:\myimage.bmp"), 0,0)
Re: display image using gdi
Check out this thread by the GDI+ Guru ;)
Re: display image using gdi
That link has more to do with manually drawing shapes. If you want to draw an image then just use Me.CreateGraphics.DrawImage(MyImage,0,0) nothing else required.
Re: display image using gdi
If you want to rotate the image then you need one of the overloads of DrawImage that takes an image and a pointf array as arguments.
Re: display image using gdi
thanks guys, i tried the me.creategraphics, but it does not draw the image. i know the image is being found, because if i wereto us a wrong filename, it shows an error.
the form is just a gray form, no image.
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.CreateGraphics.DrawImageUnscaled(Image.FromFile("C:\Documents and Settings\Cohn\My Documents\My Pictures\eclipse.jpg"), 0, 0)
End Sub
Re: display image using gdi
You need to do the drawing in the forms paint event so it will persist and redraw when the forms state or size change. ;)
Re: display image using gdi
is this what the code should look like for the function header?
Code:
Private Sub PictureBox1a(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
?