Creating a custom winform element without a constructor

How to create a custom WinForms control that does not have a GUI application or designer? An example is similar to Timer Control, which you drop on your form, and it docks to the bottom, but does not have any GUI controls?

+4
source share
2 answers

You need to use System.ComponentModel.Component as a base class .

Example:

 class Class1 : System.ComponentModel.Component { } 

Class1 is a component!

+5
source

Create a class that inherits from System.Windows.Forms.Control. This should change the icon from the regular class icon to the component icon in Solution Explorer. You can see this effect if you create a class and inherit, for example, TextBox or Timer

0
source

All Articles