gpt4 book ai didi

C# 窗体 : how do you set focus to a DataGridView component on a form?

转载 作者:太空狗 更新时间:2023-10-30 00:06:09 28 4
gpt4 key购买 nike

我在表单上有一个 DataGridView 组件。如何将焦点设置到此组件,以便它响应箭头键?

最佳答案

你可以:

dataGridView.Select();

dataGridView.Focus();

或者,您可以设置 ActiveControl 属性:

ActiveControl = dataGridView;

以下文字来自Microsoft

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# 窗体 : how do you set focus to a DataGridView component on a form?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5268735/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com