Creating new components in visual c# [closed]
There are several different ways to create new controls in C#:
The first way involves extending an existing control class, done either by deriving from the
System.Windows.Forms.Control
class (which is the base class for all controls in WinForms), or from one of its more specific subclasses (TextBox
,Button
, etc.).The
Control
class actually derives fromSystem.ComponentModel.Component
, but it adds the necessary magic that gives the component a visual interface, as you requested—a control is a component that is displayed on the screen and that presents an interface the user can interact with.The second way involves creating a custom user control. The Add New Item wizard in Visual Studio has a single-click option for inserting a new user control into your project, or you can manually derive from the
System.Windows.Forms.UserControl
class.The advantage of a user control is that it is a container control, meaning that you can put several different controls inside of a single control. This is handy for building more complex controls, rather than simply extending (or adding functionality to) one of the built-in controls.
Controls created using either of these methods can be used on a different form within your application.
Try Windows Forms Controls Libarary, or if you are WPF , you can use WPF Controls Library. You may also go through http://msdn.microsoft.com/en-us/library/a6h7e207(v=vs.71).aspx
精彩评论