问题
I've read many articles on how to create transparent labels but it seems to me that my particular case is not covered. Very simply I have a label placed in the upper right part of the form, which in fact is part of the menu strip. The label displays some info to the user but I wish it were transparent. Ive tried various methods including
lblAct.Parent = mnuMain '(or Me)
lblAct.BackColor = Color.Transparent
lblAct.BringToFront()
but cant get it to work. Anyone have suggestions on how I can make that lable in that position transparent?
Thanks
AGP
回答1:
Yes, you can't make this work. It's a Windows restriction, transparency effects are relative to the top-level window, stacking effects do not work. You'll see the form as the background, not the menu strip. Hacking a label that asks the menustrip to render itself to create the background is technically possible. But Windows won't generate a paint message when the strip repaints itself. Which will be starkly visible when the user resizes the form for example.
来源:https://stackoverflow.com/questions/3548599/transparent-label-in-menu-area-with-vb-net