.net - Edit UserControl subclass in Windows Form Designer? -
in vs2010, targeting framework 4.0, have usercontrol contains tablelayoutpanel empty second row.
is possible add items second row using windows forms designer, or have via code?
edit: in reply hans passant's comment, linked question references usercontrol being used inside control. asking question inherited controls.
i have created following test code, testcontrol usercontrol containing tablelayoutpanel named "tablelayoutpanel1":
imports system.componentmodel imports system.windows.forms.design <designer(gettype(testdesigner))> public class testcontrol end class public class testdesigner inherits controldesigner public overrides sub initialize(component system.componentmodel.icomponent) mybase.initialize(component) dim x testcontrol = ctype(component, testcontrol) enabledesignmode(x.tablelayoutpanel1, "tablelayoutpanelx") end sub end class
creating following class in new file:
public class testinheritedcontrol inherits testcontrol end class
creates control which, when viewed in designer, contained tablelayoutpanel named "tablelayoutpanel1" not designer-editable. situation described in original question, not solved.
creating new usercontrol, not inheriting either of previous usercontrols, , placing testcontrol creates instance of testcontrol designer-editable tablelayoutpanel named "testcontrol1.tablelayoutpanelx".
is there way make testinheritedcontrol
class, shown above, designer-editable?
i had similar today. way worked around use un-instantiated references in base class, actual instantiation on inheriting class.
you have add couple of steps make plug-in, gives control want. have drop tablelayoutpanel onto each inheriting control type, , in constructor, set base class' version current instantiated version (after calling initializecomponents).
this way, can "design" in inheriting control, use programmaticly base control.
Comments
Post a Comment