0

pardon me for this question but I'm a c# n00b. I'd like to show a tableLayoutPanel on the background of an image with transparent sections (so it's not an issue with transparency between 2 PictureBox, but between 1 PictureBox over a tableLayoutPanel).

I've got this image of a plate with transparent wells that I'd like to fill with the cells I draw on the tableLayoutPanel. My idea was to put the image over the tableLayoutPanel, so when I draw some cells they should appear under the transparent circles of the image. Unfortunately the image shows the background of the form (blue) on its transparent sections, but the table gets completely hidden. (SEE IMAGE: Is there any way to accomplish what I would like to? :P (I'm [enter image description here])using Visual Studio 2019)

Thanks to everybody who'll answer.

abaww
  • 11
  • 4
  • 1
    Does this answer your question? [C# PictureBox on top of another PictureBox](https://stackoverflow.com/questions/42047651/c-sharp-picturebox-on-top-of-another-picturebox) – NineBerry Dec 08 '22 at 22:49
  • 1
    While TLP is a Container it will also take control of its children; for transparency to work the overlay would have to be nested, ie a child of the TLP. This may well be impossible. - Will you need interactivity, ie shall the user click onto the TLP's children? – TaW Dec 09 '22 at 08:37
  • Thank you for the answer, I already implemented the system to draw how many columns I want to fill and from which column to start drawing from. All I need is for the TLP filled columns to be visible under the image transparent sections. – abaww Dec 09 '22 at 16:05

1 Answers1

1

Thank you for the answers, I solved my problem by drawing the image I wanted behind the tableLayoutPanel instad of using a PictureBox

g.DrawImage(Bitmap.FromFile("C:\\test\\wellpngbit.bmp"), new Rectangle(100, 150, 640, 428));

Then I set the BackColor of the tableLayoutPanel as Transparent and voilà!

This is the result I got:

enter image description here

Ticherhaz FreePalestine
  • 2,738
  • 4
  • 20
  • 46
abaww
  • 11
  • 4