如何将DataGridViewLinkColumn属性添加到DataGridView中的动态生成列?

如何将DataGridViewLinkColumn属性添加到DataGridView中的动态生成列?

问题描述:

开发中: c#winforms 没有任何数据库连接

Developing In: c# winforms without any Database Connections

说明:在我的DataGridView中,列是动态生成的。在某些方面,一些列需要是DataGridViewLinkColumn属性。我被许多方式尝试,但没有这样做。

Description: In my DataGridView, columns were dynamically generated.At some point some of the columns need to be DataGridViewLinkColumn property. I was tried in many ways but didn't achive this.

我希望有人从这里帮助我:)

I hope someone from here would help me :)

感谢提前。

您需要关闭 AutoGenerateColumns ,然后自己生成每一列。

You will need to switch off AutoGenerateColumns, then generate each column yourself.

将常规列设置为类型 DataGridViewTextBoxColumn ,然后将需要链接列的列设置为键入 DataGridViewLinkColumn

Setup the normal columns as type DataGridViewTextBoxColumn, then for the columns which need to be Linked columns set them up as type DataGridViewLinkColumn.