简体   繁体   中英

Creating a winform user control with no designer

How do I create a WinForms User Control that has no GUI or designer attachment? An example is like the Timer Control, which you drop onto your form and it docks to the bottom but doesn't have any GUI controls?

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

Example :

class Class1 : System.ComponentModel.Component
{

}

Class1是一个组件!

Create a class that inherits from System.Windows.Forms.Control. This should change the icon from the normal "class" icon to a "component" icon in the solution explorer. You can see this effect if creating a class and inheriting from say TextBox or Timer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM