|
-
Jul 14th, 2005, 03:47 PM
#1
Thread Starter
Member
display image using gdi
ive been reading a ton of articles about vb.net and GDI, but for some reason, i cant get an image to be displayed on my form.
ive tried everything.
eventually, i want to be able to rotate this image according to sensor inputs, but for now, i am concentrating on just getting this image to appear.
can someone tell me... what headers i need to include, what subs/functions i need, and what variables are supposed to be declared.
-
Jul 14th, 2005, 04:15 PM
#2
Fanatic Member
Re: display image using gdi
I assume you mean GDI+
VB Code:
Me.CreateGraphics.DrawImageUnscaled(Image.FromFile("c:\myimage.bmp"), 0,0)
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
-
Jul 14th, 2005, 04:18 PM
#3
Re: display image using gdi
Check out this thread by the GDI+ Guru
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 15th, 2005, 03:07 AM
#4
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.
I don't live here any more.
-
Jul 15th, 2005, 03:08 AM
#5
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.
I don't live here any more.
-
Jul 15th, 2005, 09:28 AM
#6
Thread Starter
Member
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
-
Jul 15th, 2005, 09:53 AM
#7
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 15th, 2005, 10:25 AM
#8
Thread Starter
Member
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
?
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
|