开发者

C# datagridview row select with CTRL and SHIFT

I need to implement datagridview selection in that way so when user clicks a cell whole row is selected, when user holds CTRL key additional rows are selected, when user holds SHIFT key range of rows are selected. According to requirement I cannot show RowHeaders so selection should be based on cell clicking. I also know that datagridview.SelectionMode = FullRowSelect will do the trick but I'm getting one problem when using SHIFT for selection - gaps. When someone selects one row, then presses SHIFT and then jumps over few row to select anoter not all cells became selected(look at the picture - rows with开发者_运维技巧 x=3,4,5 have cells which are not selected).

C# datagridview row select with CTRL and SHIFT

Help me to solve this problem.

Actually I have some ideas. For example, somehow treat clicking on a cell as clicking on a rowheader, but I'm not sure how to implement this.


datagridview.SelectionMode = FullRowSelect

and

datagridview.RowHeaderVisible=false
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜