简体   繁体   中英

C# winforms transparent form overlay issue

My main form has a horizontal splitcontainer on it. The top portion contains an Object List View control found here .

I am using code from a previous C# transparent overlay form answer .

My issue seems to have something to do with the Object List View. Using the code from the answer above, the transparent form covers all controls perfectly, however when it gets to the Object List View it seems to draw darker over this specific control.

Splitcontainer重叠

If I close the transparent overlay and bring a blank panel to the front, when I open the transparent overlay, it still shows this darker section as if the object list view control is still visible.

空白面板重叠

I would first like to know why this is happening. But I would also like to know how I can fix this so that the overlay is consistant.

  • In case you wish to test this I created a simple project to demonstrate the issue here

To replicate what happens...

  1. Drag the splitcontainer down a little and click the Overlay button.

  2. Close the overlay by clicking in the White Panel. Click the Blank Panel button then click the Overlay button again.

Please note that in the Plexiglass class, it is taking a panel as a parameter only for the sake of this demonstration, in my actual project, it takes the main form as a parameter.

EDIT

I changed the color from dark gray to white and it works perfectly. I am not sure why the dark gray was causing that issue, but I am pleased with the way it looks with white so I will stick with that.

For some reason, the Color.DarkGray BackColor attribute for the transparent form was causing the issue. Changing the BackColor to Color.White fixed this.

Thanks to Patrice Gahide for helping me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM