0

I'm using DatagridView in my project. I have to Add a DataGridView in Each form that i created. And in each form i have to Add some similar code blocks in this case. Instead of that i want to create a control library. In the library i want to implement my own behaviour (override default behaviour of that contol) .

Can anybody please help me in this regards? .How to create a custom Datagridview (inherited from the DatagridVview provided in .net) with our own behaviours in c#.net.

4

2 回答 2

0

您可以创建一个继承自 DataGridView 的用户控件并覆盖行为

于 2013-01-08T15:13:05.167 回答
0

控件只是一个类。

您可以创建自己的从DataGridView控件继承的类。

然后,您可以覆盖或添加不同的行为

public class CustomGridView : DataGridView {

   public string MyCustomProperty { get; set;}

}
于 2013-01-08T15:06:31.220 回答