C#的WinForms:你怎么焦点设置到窗体上的DataGridView的组成部分? [英] C# Winforms: how do you set focus to a DataGridView component on a form?
本文介绍了C#的WinForms:你怎么焦点设置到窗体上的DataGridView的组成部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表格上一个DataGridView组件。 ?我如何将焦点设置到该组件,使其响应箭头键
I have a DataGridView component on a form. How do I set the focus to this component so that it responds to arrow keys?
推荐答案
您可以:
dataGridView.Select();
或
dataGridView.Focus();
另外,你可以设置ActiveControl属性:
Alternatively, you could set the ActiveControl property:
ActiveControl = dataGridView;
下面的文本来自的微软
Focus是一款低水平的方法意图
主要用于自定义控件的作者。
相反,应用程序的程序员
应该用选择法或儿童
控制
ActiveControl属性,或者
形式的Activate方法。
Focus is a low-level method intended primarily for custom control authors. Instead, application programmers should use the Select method or the ActiveControl property for child controls, or the Activate method for forms.
这篇关于C#的WinForms:你怎么焦点设置到窗体上的DataGridView的组成部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文