Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys. They say a Pic is worth a thousand words. I've attached a pic which should show you my troubles without having to read so much.

I am a newbie but have been working hard at figuring out my problems on my own or thru research. Ive seen similar bot not the same issue i am experiencing.

I am making a poker game.

on the windows form I am using an image I made of a poker table as the background image.
It is green.

I have a picture box with a playing card face down so the card back is showing.
I have another picture box with the dealer button as the image (round button in a square picture box) and back color set to transparent.

When I overlap the dealer button on top of the Playing card picture box Id expect to see the card back thru the transparency property but it goes right past that so I only see the green from the window forms background image.

It doesn't matter if The playing card picture box is set to transparent or not.

can i remedy this somehow? I attached a Pic for better understanding of problem.

Project1.png - Google Drive[^]

What I have tried:

Messing with transparency keys and reasearch
Posted
Updated 26-Feb-16 6:06am
v2

1 solution

First, don't use PictureBox's at all. They are actually tying your hands together, preventing you the flexibility that you need to do this.

Second, a "transparent" control isn't. Controls in Windows Forms are never transparent.

When you set the BackColor of a control to Transparent you're not making the control "see-through". You're actually telling the control to take on the background properties of its parent container, probably your Form. If the BackColor of the Form is Green, so will be the BackColor of the PictureBox.

You will NOT be able to see other controls "through" a "transparent" control if these controls overlap.

Save yourself the paint and just draw directly on the Forms surface or on the surface of a Panel control. That's what handling the Paint event of these controls is for.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900