GDI + , Drawing from a .png file
GDI + , Drawing from a .png file
GDI + , Drawing from a .png file
GDI + , Drawing from a .png file
GDI + , Drawing from a .png file
GDI + , Drawing from a .png file GDI + , Drawing from a .png file GDI + , Drawing from a .png file GDI + , Drawing from a .png file GDI + , Drawing from a .png file GDI + , Drawing from a .png file GDI + , Drawing from a .png file GDI + , Drawing from a .png file
GDI + , Drawing from a .png file GDI + , Drawing from a .png file
GDI + , Drawing from a .png file
Go Back  Xtreme Visual Basic Talk > > > GDI + , Drawing from a .png file


Reply
 
Thread Tools Display Modes
  #1  
Old 06-22-2006, 11:09 AM
rossatron rossatron is offline
Centurion
 
Join Date: Sep 2003
Posts: 126
Default GDI + , Drawing from a .png file


Hey all. My question is this, I have a .png file for example lets call it picture.png (original huh?) and what i want to do is when i click on a button it is drawn onto the form, its transpareny and all. is this possible or will i have to use picture boxes?

thanks in advance
Reply With Quote
  #2  
Old 06-22-2006, 11:27 AM
JNewt's Avatar
JNewt JNewt is offline
Centurion
 
Join Date: Apr 2003
Location: KY (Home), ID (College)
Posts: 138
Default

You can use the DrawImage method of your form's graphics object to draw an image (check the GDI+ FAQ if you're unfamiliar with this: http://www.bobpowell.net/faqmain.htm). Not sure how DrawImage handles PNG transparency though...
If the transparency won't work, you can always use the MakeTransparent method of the Bitmap object to set a particular color as the transparent color.
__________________
Erat autem fuenum multum in loco. -John 6:10
Please forgive my English -I'm a modern American.
Reply With Quote
  #3  
Old 06-22-2006, 03:32 PM
rossatron rossatron is offline
Centurion
 
Join Date: Sep 2003
Posts: 126
Default

hey JNewt. thanks for the push in the right direction. I am using the Draw Image to draw onto the form but when the form opens it takes so friggin long for the image to show. Is there a way to say have it loaded then the form show?
Reply With Quote
  #4  
Old 06-22-2006, 06:45 PM
JNewt's Avatar
JNewt JNewt is offline
Centurion
 
Join Date: Apr 2003
Location: KY (Home), ID (College)
Posts: 138
Default

Where in the form's code are you painting the image? Generally you should use the Paint event (use the Graphics object passed in the "e" argument).
Also, don't load the image every time you paint. Declare a variable (type: bitmap) in your declarations section and then load the bitmap in the Load event of your form. Then you just need to paint it every time the form redraws.
__________________
Erat autem fuenum multum in loco. -John 6:10
Please forgive my English -I'm a modern American.
Reply With Quote
  #5  
Old 06-23-2006, 04:09 AM
rossatron rossatron is offline
Centurion
 
Join Date: Sep 2003
Posts: 126
Default

im a little confused to what you mean by declare a variable (type:bitmap). And i have fixed one problem by turning double buffering on, this solves the problem of images being loaded with the form (in the paint event) but i have a button that once clicked another image is set to be drawn. i put the coding in the button click event and when it loads it like swipes down from the top of the image to the bottom and just looks terrible. And i know it cant be my computer causing the slowness because its brand new.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
GDI + , Drawing from a .png file
GDI + , Drawing from a .png file
GDI + , Drawing from a .png file GDI + , Drawing from a .png file
GDI + , Drawing from a .png file
GDI + , Drawing from a .png file
GDI + , Drawing from a .png file GDI + , Drawing from a .png file GDI + , Drawing from a .png file GDI + , Drawing from a .png file GDI + , Drawing from a .png file GDI + , Drawing from a .png file GDI + , Drawing from a .png file
GDI + , Drawing from a .png file
GDI + , Drawing from a .png file
 
GDI + , Drawing from a .png file
GDI + , Drawing from a .png file
 
-->