datagridview trubles plz帮助 [英] datagridview trubles plz help

查看:63
本文介绍了datagridview trubles plz帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!
我希望我的网格允许选择单元格中的文本,但限制编辑.
使用readonly属性不允许选择文本. ((我的网格也有一个contextmenustrip,但是当单元格处于编辑模式时,右键单击带有复制,剪切,选择的标准菜单即可.例如,当readonly属性为false时,如何更改contextmenustrip来挖掘和限制编辑?

Hello, all!
i want that my grid allows to select text in cells, but restrict editing.
using readonly property disallows to select text. (( my grid also has a contextmenustrip, but when cell is in editing mode, right button calls standard menu with copy,cut,select e.g. How can i change contextmenustrip to mine and restrict editing when readonly property is false?

thanks for your time!

推荐答案

我遇到了类似的问题,我将选择模式设置为全行选择并启用了网格,从而解决了这个问题.
然后,我使用
读取单元格的内容
grid.selectedrows [0] .cells [0] .value

可用于任何所需目的.

对于上下文菜单条,请从工具栏中插入contextmenu工具.就像在正常菜单栏中一样,它的工作原理完全一样,只是它是在右键单击时激活的.在网格的属性上,将上下文菜单属性设置为上下文菜单.

希望这会有所帮助.
I had a similar issue which I solved by setting the selection mode to full row select and leaving the grid enabled.

I then read the contents of the cell using

grid.selectedrows[0].cells[0].value

to use for any purpose required.

For context menu strip insert the contextmenu tool from the tool bar. This works exacly like a normal menu strip except that it is activated on right click. On the properties of your grid set the context menu property to your context menu.

Hope this helps.


这篇关于datagridview trubles plz帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆