Hi,
It is impossible to visually edit the component control that is inherited from base control. Only the user control can be edited visually. But whereas component control by programmatically for visual effects
Good Luck.
Impossible is such a widely misused word ;).
Why you would want to visually edit a button class without hosting it on a container controlis beyond me, but if that's what you want to do then it's fairly simple.
You need to inherit from a control which has hijacked the usercontrol designer.
Note that not all controls can use this method, but most can.
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Windows.Forms;
namespace DesignableControls
{
[ToolboxItem(true)]
public class MyButton : MyButtonBase
{
public MyButton() : base()
{
InitializeComponent();
}
public void InitializeComponent()
{
}
}
[Designer("System.Windows.Forms.Design.UserControlDocumentDesigner, System.Design", typeof(IRootDesigner))]
[ToolboxItem(false)]
public class MyButtonBase : Button
{
}
}<br/><br/>
MyButton needs to be defined as the first class in this file and it also needs the constructor and initializeComponent() method defined so that any changes are serialized.
Mick Doherty
http://dotnetrix.co.uk