Search code examples
c#visual-studio-2019transparencytransparenttablelayoutpanel

how to make visible a tableLayoutPanel behind a transparent image?


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.


Solution

  • 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