简体   繁体   English

在DataGridView C#上直接选择项目

[英]Directly Pick Item on DataGridView C#

Anyone can help me to find an add-on or control for C# 任何人都可以帮助我找到C#的加载项或控件

我们如何专注于单元格并有额外的按钮

I have been googling around for the last few days. 最近几天我一直在谷歌搜索。 How can we focus on a cell and has extra button to pick item or open other form? 我们如何专注于单元格并有额外的按钮来选择项目或打开其他表单?

Thanks 谢谢

you can set the property ColumnType for this column to DataGridViewButtonColumn. 您可以将此列的ColumnType属性设置为DataGridViewButtonColumn。
Its an ugly button, but its a button. 它是一个丑陋的按钮,但是它是一个按钮。

Another option is using a contextmenuitem. 另一种选择是使用上下文菜单。

about your comment, using a contextmenustrip on a DataGridView is not so hard: 关于您的评论,在DataGridView上使用contextmenustrip并不难:
1. drop a contextmenuStrip from the toolbox onto your form 1.从工具箱中将contextmenuStrip拖放到表单上
2. Add a toolStripMenu and enter a text, for example "pick something" 2.添加一个toolStripMenu并输入文本,例如“ pick something”
3. set the property "ContextMenuStrip" from the DataGridview to this new contextMenuStrip 3.将DataGridview的属性“ ContextMenuStrip”设置为此新的contextMenuStrip
4. in the Click event of the toolStripMenu you can write whatever code you need 4.在toolStripMenu的Click事件中,您可以编写所需的任何代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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