Why is the Visible property not correctly updated in a UserControl?

爱⌒轻易说出口 提交于 2019-12-01 06:24:01

It may still show false if the Form has not loaded. Try setting it in the Form's OnLoad event.

Reading the Visible property gives you the actual visibility state of the control, not the 'intended' state. Which will always be false in the InitializeComponent() method, the form or control isn't visible yet until after the Load event runs. It will also be false if the container control isn't visible.

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