Link to home
Start Free TrialLog in
Avatar of Christian de Bellefeuille
Christian de BellefeuilleFlag for Canada

asked on

Button transparency problem: Doesn't respect Z-Order

Hi,
I'll try to make it short.  To show you my problem i've created a picture to illustrate my problem: http://www.ideomation.com/bug.jpg

The first 2 buttons (Librarie) is what i get when my form background contain the image of the button, and that i set my button background to be transparent & flat, and set the FlatAppearance MouseOverBackColor property to black.  The first image is when the mouse is out of the button, and the 2nd is when it's over it.

Under the red line, you can see a button "Renommer" that i misplaced to show my problem.  This happen when i place a transparent button over a picturebox.  The transparent button doesn't show the picturebox under the button, but it show the form background image!

Does transparency should respect the Z-Order of items placed on my form?
If so... why am i getting this error and how can i solve this problem?

I thought about writting a piece of code to just hide the picturebox when the mouse is over the button, and it work, but the problem is that it doesn't look like my black "librairie" button because the shadow dissappear with the picturebox!

Thanks for your help
ASKER CERTIFIED SOLUTION
Avatar of Joel Coehoorn
Joel Coehoorn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
what about the trans of the pic box ?

waiting for your reply
Avatar of Christian de Bellefeuille

ASKER

Smart Man...

The idea is to have a Transparent Button over a Non-Transparent PictureBox...
why would i set it as tranparent?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
An image box?  What kind of component is that?  I don't see any Image box anywhere in VS2005.  There's a PictureBox, and an ImageList.  The ImageList is not used to show pictures since it have no space on the form.

To answer your question, the white box doesn't have the same size than the picture.  It's lightly smaller than the image itself because i want to be able to see the shade of the button istelf.

The only workarround i've found is to place every button on the background image of the form, and place some stuff over it and use their visibility to show or hide them.    Example, if i have few buttons over a grid, i must take a snapshot of that grid and create a JPG with it.  Then i add buttons on my background image of the form, then i add a picture box with that blank grid over them to hide the buttons.  

But honnestly, my workarround is just plain stupid...  it would only mean that Microsoft failed to design their stuff.  If you have 3 objects 1 over each other and that the top one have a transparent background, it shouldn't show any color & background and show the item just below it, not the Nth object behind, or even worse the form background!

So my guess is that jcoehoorn was right... it's really a bug of MS and there's no patch for that.

Thanks for your time