This documentation is archived and is not being maintained.

.NET Samples - Windows Forms: Control Authoring

.NET Framework 1.1

This section includes the following samples:

UserControl Sample

LicensedControl Sample

SimpleControl Sample

Hello World Control Sample

CustomUITypeEditor Sample

HelpLabel Sample

UserControl Sample

This sample demonstrates the creation of a user control by extending System.Windows.Forms.UserControl. User controls provide more innate functionality than a normal control would so that the user doesn't have to program as much logic for various functions like scrolling and functioning as a control container.

Link to the online sample documentation

Link to the online sample source code

Namespaces used in this sample:

(none)

Classes used in this sample:

(none)

LicensedControl Sample

This sample demonstrates the use of a License object to protect a user control from being run in an unlicensed host container.

Link to the online sample documentation

Link to the online sample source code

Namespaces used in this sample:

System; System.Drawing; System.ComponentModel; System.Windows.Forms

Classes used in this sample:

License; Control; Form; Component; Container; LicenseProvider; Font; LicFileLicenseProvider; Style; Application; Thread; Brush; Graphics; PaintEventArgs; LicenseProviderAttribute; SolidBrush; File; EventArgs; String; LicenseManager; Attribute

SimpleControl Sample

This sample demonstrates the use of control-authoring attributes in order to interact with the Visual Studio designer. In the sample, various properties of the control are made visible to the browser, given descriptions, and given default values.

Link to the online sample documentation

Link to the online sample source code

Namespaces used in this sample:

System; System.Drawing; System.Windows.Forms; System.ComponentModel

Classes used in this sample:

Button; Control; Form; EventArgs; Font; Component; EventHandler; RadioButton; Style; MessageBox; Message; Graphics; Brush; Group; GroupBox; Container; SolidBrush; String; Thread; FontFamily; Icon; PaintEventArgs; Application

Hello World Control Sample

This sample shows code required for a basic Windows Forms control. The code is derived from System.Windows.Forms.Control and overrides the OnPaint event so that the control can custom paint its client area.

Link to the online sample documentation

Link to the online sample source code

Namespaces used in this sample:

System; System.Drawing; System.Windows.Forms; System.ComponentModel

Classes used in this sample:

Control; Form; Font; Component; Style; Container; Application; String; EventArgs; Brush; Thread; Icon; Graphics; SolidBrush; PaintEventArgs; FontFamily

CustomUITypeEditor Sample

This sample demonstrates the code needed to implement a custom UI type editor. This sample creates a type editor for the FlashTrackBar control to provide a better view to the user when they are editing various properties for the FlashTrackBar.

Link to the online sample documentation

Link to the online sample source code

Namespaces used in this sample:

System; System.Drawing; System.Windows.Forms; System.ComponentModel; System.Drawing.Design; System.Diagnostics; System.ComponentModel.Design; System.Drawing.Drawing2D; System.Windows.Forms.Design

Classes used in this sample:

TrackBar; Font; Form; Component; EventArgs; Style; String; Instance; Type; Control; Graphics; Brush; Convert; UITypeEditor; Service; Container; Capture; Image; MouseEventArgs; EventHandler; SolidBrush; Context; Math; TypeDescriptor; Application; Icon; Thread; LinearGradientBrush; PaintEventArgs; TextureBrush; Debug

HelpLabel Sample

This sample demonstrates a simple extender provider. When an extender provider is added to a Form, all other controls gain properties from the extender provider. This sample adds a HelpText property to every control and provides a Help pop-up window when you move the pointer over the control.

Link to the online sample documentation

Link to the online sample source code

Namespaces used in this sample:

System; System.Drawing; System.Windows.Forms; System.ComponentModel; System.Windows.Forms.Design; System.ComponentModel.Design; System.Collections

Classes used in this sample:

Label; Control; Help; Form; Service; Component; EventHandler; Style; EventArgs; DesignerVerb; Pen; Button; SystemColors; Container; Type; TextBox; TypeDescriptor; Hashtable; Hash; Graphics; DesignerVerbCollection; Brush; Attribute; SolidBrush; Thread; Message; Font; MessageBox; PaintEventArgs; String; Icon; CategoryAttribute; Application

Show: