dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


advertisement
 

.NET Building Blocks: Custom User Controls in Practice  : Page 2

Learn the differences between the various types of custom controls, and find out how to integrate your controls into Visual Studio and make them easy to use.


advertisement

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Implementation Details: The Composite Control
A composite control is a collection of Windows Forms controls encapsulated in a common container derived from UserControl. This kind of control is thus referred to generically as a user control. The contained controls are called constituent controls. See Table 1.
Table 1. Composite Control Usage
Composite Control Manifestation Description
Add User Control Dialog Start with the User Control template.
Generated Code public partial class UserControl1 :
UserControl
{
  public UserControl1()
  {
     InitializeComponent();
  }
}
The composite control derives from UserControl.
Designer Canvas The designer opens with a blank canvas.
Runnable in test container? Yes  

Implementation Details: The Extended User Control
An extended user control derives from a single, existing control that you have created (e.g., the ClockControl), as distinct from the extended system control, a control derived from a standard .NET control (e.g., GroupBox) shown next. Table 2 provides details on the extended user control.

Table 2. Extended User Control Usage
Extended User Control Manifestation Description
Add User Control Dialog Use the Inherited User Control template. Upon pressing Add, an additional dialog opens requiring you to select the base control.
Generated Code public partial class UserControl1 :
ControlLib.ClockControl
{
  public UserControl1()
  {
     InitializeComponent();
  }
}
The extended control derives from the base control you selected.
Designer Canvas The designer canvas renders the base control immediately.
Runnable in test container? Yes  



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date