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.
对于 C# Windows 窗体应用程序,如何在应用程序启动时将默认焦点设置到给定控件?
具有最小标签索引的那个会自动获得焦点(假设该TabStop属性设置为 true)。只需适当地设置选项卡索引。
TabStop
顺便说一句,Visual Studio 提供了一种方法来轻松设置选项卡索引,只需按您想要的顺序单击控件即可。当您在表单设计视图中时,您可以通过在“视图”菜单中选择“标签顺序”选项来激活此功能。
Select您还可以通过在表单加载时调用其方法来手动将焦点赋予控件。
Select