C#视觉子类datagridview控件VS2005 [英] C# visually subclass datagridview control VS2005
问题描述
public class MyDataGridView:DataGridView
{}
没有问题,我把一些我想要全球适用的东西/元素。现在,我把这个gridview放在一个包含其他控件的自定义用户控件中。所以我有像视觉设计师创造的东西。我抓住一些按钮,标签和我的派生MyDataGridView。
public partial class MyCompoundDGVPlus:UserControl
所以现在,我可以根据需要直观地绘制,移动,更改各种设置,没问题。 >
现在,我想要这个MyCompoundDGVPlus类作为其他类的基础,其中我将操纵特定的设置,但希望所有的具有相同的外观/感觉,否则相似流程,因此导出。
我甚至将修饰符设置设置为public,所以我应该能够修改控件的任何属性派生级别。那么现在,我创建一个从MyCompoundDGVPlus派生的MyFirstDetailedDGVPlus的新子类。在视觉上确定,所有的标签,按钮,datagridview都会出现。但是,现在我想在这个类中直观地定义datagridview的列,但是它被锁定。但是,表单上的LABEL,我可以获取所有的属性设置....
我缺少什么。
也许你应该看看这个帖子,因为它似乎做你想要的:
DataGridView锁定在继承的UserControl
Maybe its something stupid, but I'm having a problem with a subclass of a DataGridView Control in VS2005 C#. I know I can subclass from almost anything by doing
public class MyDataGridView : DataGridView
{}
no problem, and I put in some things / elements I want applicable globally. Now, I take this gridview and put into a custom user control that will contain other controls too. So I have something like created by the visual designer. I grab some buttons, label, and my derived "MyDataGridView" on it.
public partial class MyCompoundDGVPlus : UserControl
So, now, I can visually draw, move, change all sorts of settings as needed, no problem.
Now, I want this "MyCompoundDGVPlus" class as the basis for other classes, of which I will manipulate settings specific, but want all to have the same look / feel, and otherwise similar flow, hence the derivations.
I've even set the "modifiers" setting to public, so I SHOULD be able to modify any of the properties of the controls at any derived level. So, now, I create a new subclass of "MyFirstDetailedDGVPlus" derived from "MyCompoundDGVPlus". Ok visually, all the label, button, datagridview appear. However, now I want to specifically define the columns of the datagridview here in this class visually, but its locked. However, the LABEL on the form, I CAN get all the property settings....
What am I missing.
Maybe you should take a look at this post as it seems to do what you are looking for : DataGridView locked on a inherited UserControl
这篇关于C#视觉子类datagridview控件VS2005的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!