By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,569 Members | 1,630 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,569 IT Pros & Developers. It's quick & easy.

PaintPicture -- How??

P: n/a
I recently got VB.NET, and now I need to somehow use the PaintPicture
command from VB6. Obviously it does not exist in .NET. I would do this
in 6 but I need to use pngs as images, because only they support
semi-transparent pixels.

Thanks in advance,
Nov 20 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Anagnos,

Does not exist, start reading here?

http://msdn.microsoft.com/library/de...us/GDIPlus.asp

I hope this helps?

Cor
I recently got VB.NET, and now I need to somehow use the PaintPicture
command from VB6. Obviously it does not exist in .NET. I would do this
in 6 but I need to use pngs as images, because only they support
semi-transparent pixels.

Thanks in advance,

Nov 20 '05 #2

P: n/a
Hi,

Take a look at the graphics class drawimage method.
http://msdn.microsoft.com/library/de...imagetopic.asp

Ken
----------------
"Anagnos" <fr***********@yahoo.com> wrote in message
news:57**************************@posting.google.c om...
I recently got VB.NET, and now I need to somehow use the PaintPicture
command from VB6. Obviously it does not exist in .NET. I would do this
in 6 but I need to use pngs as images, because only they support
semi-transparent pixels.

Thanks in advance,
Nov 20 '05 #3

P: n/a
The help says that you can use the drawimage but i'd rather not have it
as an event, is there anyway to just use a line of code for it? Or even
a way to call on the PaintEventArgs event?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #4

P: n/a
Hi,

Try something like this.

Dim g as graphics = picturebox1.creategraphics

Ken
------------------
"Andrew Gaubatz" <fr***********@yahoo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
The help says that you can use the drawimage but i'd rather not have it
as an event, is there anyway to just use a line of code for it? Or even
a way to call on the PaintEventArgs event?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #5

P: n/a
Hi,

The load event occurs before the paint event. So the paint
event erases the stuff drawn in the load event. If you want the picturebox
to redraw itself set the picturebox image property.

PictureBox1.image = Image.FromFile("C:\Documents and
Settings\Telemachus\Desktop\1.png")

Ken
--------------------------
"Andrew Gaubatz" <fr***********@yahoo.com> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...
Thanks,

Unfortunatly this still does not work, the form loads fine but nothing
happens. here is my code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim g As Graphics = PictureBox1.CreateGraphics
PictureBox1.CreateGraphics.DrawImage(System.Drawin g.Image.FromFile("C:\D
ocuments and Settings\Telemachus\Desktop\1.png"), 1, 1)

End Sub


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #6

P: n/a
Thanks,

Unfortunatly this still does not work, the form loads fine but nothing
happens. here is my code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim g As Graphics = PictureBox1.CreateGraphics
PictureBox1.CreateGraphics.DrawImage(System.Drawin g.Image.FromFile("C:\D
ocuments and Settings\Telemachus\Desktop\1.png"), 1, 1)

End Sub


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #7

P: n/a
Thanks, I got it working just by delaying the code with a timer. Thanks
again.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #8

P: n/a
Thanks, that works but I am going to end up needing to have multiple
images in the picture box. Any way to do that?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #9

P: n/a

"Andrew Gaubatz" <fr***********@yahoo.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
Thanks, I got it working just by delaying the code with a timer. Thanks
again.


Use the Paint event of the picture box. Every time the picture box needs
updating it will fire this event and then you draw your picture(s).
Nov 20 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.