Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道 user32 中是否有一个函数可以启用 hwnd 控件,如果它被禁用(灰色)如果我知道句柄,那么我可以这样做吗?另外,如果是菜单项,也可以吗?
谢谢
您可以在 Windows API 中P/Invoke EnableWindow函数。
并非所有控件,尤其是自定义绘制和处理的控件,都会完全遵守这一点,但它应该提供良好的功能来防止用户输入控件,即使它没有“变灰”。所有标准控件都应该可以正常工作。
VB.NET 语法可从 pinvoke.net 获得。