开发者

Creating new components in visual c# [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

Can u tell me how can i create my own visual components in c#.开发者_StackOverflow中文版

which source do u advise?


There are several different ways to create new controls in C#:

  1. 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 from System.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.

  2. 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜