[英]Data Grid View Selection c#
Recently I made the 2048 game using a DataGridView. 最近,我使用DataGridView制作了2048游戏。 Everything works except for the blue selection/focus that appears on the DataGrid when my form starts and I use the arrow keys.
一切正常,除了我的表单启动并且使用箭头键时出现在DataGrid上的蓝色选择/焦点。 I tried to remove it with ClearSelection(), works except for the arrows.
我试图用ClearSelection()删除它,除了箭头以外,其他都起作用。 How could I disable the blue selected cell?
如何禁用蓝色选中的单元格? How can I disable the arrows?
如何禁用箭头?
public Form1_Load (......)
{
DataGridView1.ClearSelection();
}
Image Link (I need more reputation to upload it on the site) 图片链接(我需要更多信誉才能在网站上上传)
http://s23.postimg.org/beekn9i6z/Immagine.png http://s23.postimg.org/beekn9i6z/Immagine.png
Screenshot of Datagrid during Runtime 运行期间Datagrid的屏幕截图
http://s1.postimg.org/s5loh0uvj/datagrid.png http://s1.postimg.org/s5loh0uvj/datagrid.png
Handling selection in form load is too early because form is not shown yet. 在表单加载中处理选择还为时过早,因为尚未显示表单。 Perform datagridview clear selection in form shown event.
在显示的表单事件中执行datagridview清除选择。
private void Form1_Shown(object sender, EventArgs e)
{
DataGridView1.ClearSelection();
}
OR 要么
void dataGridView2_SelectionChanged(object sender, EventArgs e)
{
dataGridView2.ClearSelection();
}
尝试这个
DataGridView1.CurrentCell.Selected = false;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.