[英]C#: Data Grid View Advanced Operations
I am developing a windows form application in C#. 我正在用C#开发Windows窗体应用程序。 I have a datagridview on windows form.
我在Windows窗体上有一个datagridview。 This datagridview is poupulated dynamically, through some text file.
这个datagridview是通过一些文本文件动态填充的。 Now what i want to achieve the following functionaity
现在我想要实现以下功能
1) Normally, when user clicks on my datagridview then the respected cell is selceted i want to remove this functionality.ie if user click anywhere on my datagridview then noting will happens 1)通常,当用户单击我的datagridview时,将选择要删除的受关注单元格,我想删除此功能。即,如果用户单击我的datagridview上的任意位置,则会发生提示
2) Along with this datagridview i also have a menu strip in my form, the second thing which i want to achieve is that when user click on a specific button (say B) then my mouse cursor changes to plus shape(+) and it allows user to draw a box on my datagridview. 2)除了这个datagridview之外,我的窗体中还具有一个菜单栏,我要实现的第二件事是,当用户单击特定按钮(例如B)时,我的鼠标光标变为plus shape(+),并且允许用户在我的datagridview上绘制一个框。 On the basis of which i later perform some calculation.
在此基础上,我稍后进行一些计算。
Since i am new to .net thats why i don't know how to acheive this. 由于我是.net的新手,所以我不知道如何实现这一点。 So reference to some tutorial will also work.
因此,参考一些教程也可以。
You first part of the question can be done by 您的第一部分问题可以通过
dataGridView1.Enabled = false;
dataGridView1.CurrentCell = null;
Can you elaborate a bit more on the second 您能否在第二点再详细说明一下
对于您说的第一个问题,在“ Selected index grid.Selectedindex=-1;
event” grid.Selectedindex=-1;
编写以下代码grid.Selectedindex=-1;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.