Windows handle if a control is set to visible = false (.NET)

﹥>﹥吖頭↗ 提交于 2019-12-11 07:53:37

问题


Quick question, do controls in .NET have handles (hWnd) if they are set to invisible?

Marlon


回答1:


The handle is created when the Visible property becomes true. If it was set to true in the form constructor, the most common case for controls, that will happen when the form is created, right before the Load event. Setting Visible to false again doesn't destroy the handle.




回答2:


If a .Net Control already had a handle then setting it to Visible=false will not remove it. It is possible though to see a .Net Control without a handle. Handles are created on demand in WinForms and it's possible to see the lack of a handle before an operation has forced it into existence.



来源:https://stackoverflow.com/questions/2820807/windows-handle-if-a-control-is-set-to-visible-false-net

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