C# visually subclass datagridview control VS2005

∥☆過路亽.° 提交于 2019-12-08 00:51:50

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/2595549/c-sharp-visually-subclass-datagridview-control-vs2005

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!