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.
我在 Windows 应用程序中有一个 TreeView 控件。我正在从 TreeView 单击(单击)事件中打开另一个窗口(在选项卡式环境中,因此所有窗口都将在 Visual Studio 中显示为选项卡)。我想将焦点设置在新窗口的一个控件上。
问题是,我可以将焦点设置在 TreeView 的双击事件上。但同样似乎不适用于 TreeView 单击事件。
任何解决方法?
您是否尝试过在 MouseUp 中执行此操作?如果失败了,当涉及到这样的 UI 问题时,总是有一个简单(但令人作呕)的解决方案:启动一个计时器(运行时间为 10 毫秒左右),它会在它触发时设置焦点。