Transparent Label in Menu area with VB.NET

喜欢而已 提交于 2019-12-12 10:24:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!