Click here to Skip to main content
13,257,667 members (78,387 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
I have a user control which background color is black and there 3 images.
1st one is on entire usercontrol and 2nd one is bottom part of usercontrol and last one is on second image with transperent background it is .png image but now when i set background transprent for it it always shows black
can any one tell me how to set it to black??
Posted 13-Apr-13 21:31pm
Comments
   
PictureBox suggests it's System.Windows.Forms. Please tag "WinForms".
—SA

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

If it is transparent, it's not really black. :-)

If you think what is transparency, you will understand that this concept is a kind of metaphor. It only makes sense if you have something to show under a "transparent" graphics. Moreover, it has strict sense only if there is some motion. You move top object and observe the objects underneath. You need to think if you want a form to be transparent, and see the windows of the different applications under it.

That said, you should understand that transparency of control is not well supported by System.Windows.Forms. If you need something flexible and advanced, switch to WPF, don't waste time of Forms, or give it up. If you have something limited, think about rendering of GDI objects in one custom control; this will work perfectly. And of course, don't even think about using PictureBox; it makes no sense at all. Please see some of my past answers:
How do I clear a panel from old drawing[^],
draw a rectangle in C#[^],
Append a picture within picturebox[^];
see also:
Drawing Lines between mdi child forms[^],
capture the drawing on a panel[^],
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^],
How to speed up my vb.net application?[^].

—SA
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web03 | 2.8.171114.1 | Last Updated 14 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100