Jump to content
  • Advertisement
Sign in to follow this  
phil05

Need help making a C# transparent picture box

This topic is 4978 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm not really sure what to do. I'm currently messing around with this, but no luck with it. Any help is appreciated.
this.picIntro.BackColor = System.Windows.Forms.Controlstyles.SupportsTransparentBackColor = true;
Thanks, Phil

Share this post


Link to post
Share on other sites
Advertisement
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingimagingpixelformatclasstopic.asp

For information like that why don't you go through the MSDN library. Look at the .NET documentation. It comes in handy.

Share this post


Link to post
Share on other sites
I already looked at that page. It is a reference, not a tutorial. What they provide does not show how it can be assigned to the picture box.

Share this post


Link to post
Share on other sites
You can't make a picturebox truly transparent, so I would suggest looking up the graphics object.
Alright, since I don't know if you know exactly what a graphics object is, I'll explain some points that I want you to know. A graphics object is an object that will let you draw on images(such as bitmaps, images, or even the graphics of your from or controls). A graphics object is not something you draw on. You assign a graphics object to an image or bitmap, and then all the drawing you do with the graphics object will be assigned to the image.
One way to draw things with transparency with graphics object is to do the following:

1) Get your image that you want drawn with transparent parts all set up. Then for the transparent parts, set a color that will be transparent(I like to use purple). Make sure that for all the parts you want transparent, you draw them your color that is going to be turned transparent(purple if you picked that color).

2) Next declare and load your picture in a bitmap(make sure its a bitmap).

3) Call [The bitmap's name].MakeTransparent([your transparent color here])

4) Declare and set your graphics object to whatever you want it to draw to by using Graphics.FromImage([what you want it to draw on]).

5) Use [your graphics object].DrawImage() to draw your image with its transparent parts.

6) Remember to set the image you drew on to something you can see!

Good luck!
I hope this helped you, if you need more help please post back, and please send me a PM so I can know to look here again.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!