简体   繁体   中英

C#: Data Grid View Advanced Operations

I am developing a windows form application in C#. I have a datagridview on windows form. This datagridview is poupulated dynamically, through some text file. 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

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. 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. 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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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