简体   繁体   English

如何在DataGridView c#中移动光标

[英]How to move the cursor in a DataGridView c#

How to move the cursor in a DataGridView?如何在 DataGridView 中移动光标? No. .Selected = true;.Selected = true; as this puts the cell in blue by default!因为这默认情况下会将单元格设为蓝色! I want the cursor to move When I click on "Add" button, I want the cursor moves to the last row and last column我希望光标移动当我单击“添加”按钮时,我希望光标移动到最后一行和最后一列

i use :我用 :

this.dGridView.Rows[nbr].Cells[0].Selected = true;
this.dGridView.BeginEdit(true);

but it doesn't work但它不起作用

thanks for help感谢帮助

I'm not sure this will give you what you want, but you can change the selection background and foreground colors to negate the normal, default appearance of a cell being selected.我不确定这会给你你想要的,但你可以改变选择背景和前景色来否定被选择的单元格的正常默认外观。 Get the DataGridViewCell Style property.获取 DataGridViewCell 样式属性。 Then change the Style's SelectionBackColor and SelectionForeColor.然后更改样式的 SelectionBackColor 和 SelectionForeColor。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM