Windows窗体:如何扩展按钮?

Roo*_*ian 4 c# winforms

如何扩展按钮?

我想要一个具有附加属性IsSwitchOffable的Button.

我是否必须编写额外的自定义控件?

编辑: 我希望该按钮可用作标准的WindowsFormsButton.

这包括我可以在设计时添加按钮!

Ice*_*ind 7

Extending a button control is no different then extending any class in C#. Simply do the following:

class ToggleButton : Button {
// Add your extra code
}
Run Code Online (Sandbox Code Playgroud)