Varieties of Custom Controls

With the .NET Framework, you can develop and implement new controls. You can extend the functionality of the familiar user control as well as existing controls through inheritance. You can also write custom controls that perform their own painting.

Deciding which kind of control to create can be confusing. This topic highlights the differences among the various kinds of controls from which you can inherit, and provides you with information about how to choose a particular kind of control for your project.

NoteNote

For information about authoring a control to use on Web Forms, see Developing Custom ASP.NET Server Controls.

Base Control Class

The Control class is the base class for Windows Forms controls. It provides the infrastructure required for visual display in Windows Forms applications.

The Control class performs the following tasks to provide visual display in Windows Forms applications:

  • Exposes a window handle.

  • Manages message routing.

  • Provides mouse and keyboard events, and many other user interface events.

  • Provides advanced layout features.

  • Contains many properties specific to visual display, such as ForeColor, BackColor, Height, and Width.

  • Provides the security and threading support necessary for a Windows Forms control to act as a Microsoft® ActiveX® control.

Because so much of the infrastructure is provided by the base class, it is relatively easy to develop your own Windows Forms controls.

Kinds of Controls

Windows Forms supports three kinds of user-defined controls: composite, extended, and custom. The following sections describe each kind of control and give recommendations for choosing the kind to use in your projects.

Composite Controls

A composite control is a collection of Windows Forms controls encapsulated in a common container. This kind of control is sometimes called a user control. The contained controls are called constituent controls.

A composite control holds all of the inherent functionality associated with each of the contained Windows Forms controls and enables you to selectively expose and bind their properties. A composite control also provides a great deal of default keyboard handling functionality with no extra development effort on your part.

For example, a composite control could be built to display customer address data from a database. This control could include a DataGridView control to display the database fields, a BindingSource to handle binding to a data source, and a BindingNavigator control to move through the records. You could selectively expose data binding properties, and you could package and reuse the entire control from application to application. For an example of this kind of composite control, see How to: Apply Attributes in Windows Forms Controls.

To author a composite control, derive from the UserControl class. The UserControl base class provides keyboard routing for child controls and enables child controls to work as a group. For more information, see Developing a Composite Windows Forms Control.

Recommendation

Inherit from the UserControl class if:

  • You want to combine the functionality of several Windows Forms controls into a single reusable unit.

Extended Controls

You can derive an inherited control from any existing Windows Forms control. With this approach, you can retain all of the inherent functionality of a Windows Forms control, and then extend that functionality by adding custom properties, methods, or other features. With this option, you can override the base control's paint logic, and then extend its user interface by changing its appearance.

For example, you can create a control derived from the Button control that tracks how many times a user has clicked it.

In some controls, you can also add a custom appearance to the graphical user interface of your control by overriding the OnPaint method of the base class. For an extended button that tracks clicks, you can override the OnPaint method to call the base implementation of OnPaint, and then draw the click count in one corner of the Button control's client area.

Recommendation

Inherit from a Windows Forms control if:

  • Most of the functionality you need is already identical to an existing Windows Forms control.

  • You do not need a custom graphical user interface, or you want to design a new graphical user interface for an existing control.

Custom Controls

Another way to create a control is to create one substantially from the beginning by inheriting from Control. The Control class provides all of the basic functionality required by controls, including mouse and keyboard handling events, but no control-specific functionality or graphical interface.

Creating a control by inheriting from the Control class requires much more thought and effort than inheriting from UserControl or an existing Windows Forms control. Because a great deal of implementation is left for you, your control can have greater flexibility than a composite or extended control, and you can tailor your control to suit your exact needs.

To implement a custom control, you must write code for the OnPaint event of the control, as well as any feature-specific code you need. You can also override the WndProc method and handle windows messages directly. This is the most powerful way to create a control, but to use this technique effectively, you need to be familiar with the Microsoft Win32® API.

An example of a custom control is a clock control that duplicates the appearance and behavior of an analog clock. Custom painting is invoked to cause the hands of the clock to move in response to Tick events from an internal Timer component. For more information, see How to: Develop a Simple Windows Forms Control.

Recommendation

Inherit from the Control class if:

  • You want to provide a custom graphical representation of your control.

  • You need to implement custom functionality that is not available through standard controls.

ActiveX Controls

Although the Windows Forms infrastructure has been optimized to host Windows Forms controls, you can still use ActiveX controls. There is support for this task in Visual Studio. How to: Implement a Client of the Event-based Asynchronous Pattern
How to: Use Components That Support the Event-based Asynchronous Pattern
How to: Implement a Component That Supports the Event-based Asynchronous Pattern
How to: Create Threads
How to: Log Events for Multithreaded Components
How to: Display Forms from Components
How to: Create Component Containers
How to: License Components and Controls
How to: Specify a Help File for Your Component
How to: Manipulate Controls from Threads
How to: Coordinate Multiple Threads of Execution
How to: Extend Component Containers
How to: Provide Metadata for Component Properties, Methods, and Events
code munging
How to: Add a Trusted Publisher to a Client Computer for ClickOnce Applications
How to: Retrieve Query String Information in a ClickOnce Application
How to: Specify an Alternate Location for Deployment Updates
How to: Include a Data File in a ClickOnce Application
How to: Create Standard Windows Forms Print Jobs
Windows Forms Community Support
How to: Determine Which Modifier Key Was Pressed
How to: Create Application Settings
How to: Complete Windows Forms Print Jobs
How to: Add Data to the Clipboard
How to: Create Event Handlers at Run Time for Windows Forms
How to: Print Graphics in Windows Forms
How to: Print a Multi-Page Text File in Windows Forms
How to: Handle User Input Events in Windows Forms Controls
How to: Capture User Input from a PrintDialog at Run Time
How to: Create a Windows Forms Application from the Command Line
How to: Respond to Font Scheme Changes in a Windows Forms Application
How to: Support COM Interop by Displaying Windows Forms on a Shared Thread
How to: Connect Multiple Events to a Single Event Handler in Windows Forms
How to: Resize Windows Forms
How to: Modify Keyboard Input to a Standard Control
How to: Choose the Printers Attached to a User's Computer in Windows Forms
How to: Simulate Mouse and Keyboard Events in Code
How to: Support COM Interop by Displaying a Windows Form with the ShowDialog Method
How to: Retrieve Data from the Clipboard
How to: Validate Application Settings
How to: Support COM Interop by Displaying Each Windows Form on Its Own Thread
How to: Display Dialog Boxes for Windows Forms
How to: Change the Borders of Windows Forms
How to: Handle Keyboard Input at the Form Level
How to: Distinguish Between Clicks and Double-Clicks
How to: Perform Drag-and-Drop Operations Between Applications
How to: Save Files Using the SaveFileDialog Component
How to: Create an MDI Window List with MenuStrip (Windows Forms)
How to: Determine Which TreeView Node Was Clicked (Windows Forms)
How to: Change the Delay of the Windows Forms ToolTip Component
How to: Set the Background of a Windows Forms Panel
How to: Display Time with the DateTimePicker Control
How to: Change Displayed Data at Run Time in the Windows Forms DataGrid Control
How to: Anchor and Dock Child Controls in a TableLayoutPanel Control
How to: Access Objects Bound to Windows Forms DataGridView Rows
How to: Set the Value Displayed by the Windows Forms ProgressBar Control
How to: Navigate Data with the Windows Forms BindingNavigator Control
How to: Add ToolStrip Items Dynamically
How to: Insert a MenuStrip into an MDI Drop-Down Menu (Windows Forms)
How to: Position a ToolStripItem on a ToolStrip
How to: Access Specific Items in a Windows Forms ComboBox, ListBox, or CheckedListBox Control
How to: Bind the Windows Forms DataGrid Control to a Data Source
How to: Make Thread-Safe Calls to Windows Forms Controls
How to: Move Through a DataSet with the Windows Forms BindingNavigator Control
How to: Change Styles on an Element in the Managed HTML Document Object Model
How to: Bind Data to the Windows Forms DataGridView Control
How to: Determine Checked Items in the Windows Forms CheckedListBox Control
How to: Use the Spring Property Interactively in a StatusStrip
How to: Set Pictures at Run Time (Windows Forms)
How to: Set Default Cell Styles for the Windows Forms DataGridView Control
How to: Customize Item Addition with the Windows Forms BindingSource
How to: Add and Remove Items with the Windows Forms ListView Control
How to: Automatically Resize Cells When Content Changes in the Windows Forms DataGridView Control
How to: Manipulate Bands in the Windows Forms DataGridView Control
How to: Add Menu Items to a ContextMenuStrip
How to: Create Master/Detail Lists with the Windows Forms DataGrid Control
How to: Designate a Windows Forms Button as the Accept Button
How to: Create a Windows Forms Control That Shows Progress
How to: Designate a Windows Forms Button as the Cancel Button
How to: Add ToolTips to Individual Cells in a Windows Forms DataGridView Control
How to: Set Options with Windows Forms CheckBox Controls
How to: Make Columns Read-Only in the Windows Forms DataGridView Control
How to: Set Font Attributes for the Windows Forms RichTextBox Control
How to: Freeze Columns in the Windows Forms DataGridView Control
How to: Set the Selection Mode of the Windows Forms DataGridView Control
How to: Change the Border and Gridline Styles in the Windows Forms DataGridView Control
How to: Add Tables and Columns to the Windows Forms DataGrid Control
How to: Give Your Control a Transparent Background
How to: Implement Virtual Mode with Just-In-Time Data Loading in the Windows Forms DataGridView Control
How to: Configure ContextMenuStrip Check Margins and Image Margins
How to: Bind Data to the MaskedTextBox Control
How to: Show a Font List with the FontDialog Component
How to: Set the Text Displayed by a Windows Forms Control
How to: Add Web Browser Capabilities to a Windows Forms Application
How to: Display a Date in a Custom Format with the Windows Forms DateTimePicker Control
How to: Display Error Icons for Form Validation with the Windows Forms ErrorProvider Component
How to: Load a Sound Asynchronously within a Windows Form
How to: Play a Sound from a Windows Form
How to: Hide Columns in the Windows Forms DataGridView Control
How to: Print with a WebBrowser Control
How to: Enable the TAB Key to Move Out of a ToolStrip Control
How to: Access the Managed HTML Document Object Model
How to: Hide ToolStripMenuItems
How to: Add and Remove Menu Items with the Windows Forms ContextMenu Component
How to: Iterate Through All Nodes of a Windows Forms TreeView Control
How to: View Multiple Lines in the Windows Forms TextBox Control
How to: Choose Folders with the Windows Forms FolderBrowserDialog Component
How to: Configure MenuStrip Check Margins and Image Margins
How to: Set the ToolStrip Renderer for an Application
How to: Display a Web Page from a Windows Forms LinkLabel Control (Visual Basic)
How to: Customize the Appearance of Cells in the Windows Forms DataGridView Control
How to: Save Files with the Windows Forms RichTextBox Control
How to: Create a Lookup Table for a Windows Forms ComboBox, ListBox, or CheckedListBox Control
How to: Join ToolStripPanels
How to: Create Access Keys for Windows Forms Controls
How to: Manipulate Rows in the Windows Forms DataGridView Control
How to: Set the ToolStrip Renderer at Run Time
How to: Display Images in Cells of the Windows Forms DataGridView Control
How to: Access the HTML Source in the Managed HTML Document Object Model
How to: Implement Two-Way Communication Between DHTML Code and Client Application Code
How to: Add Search Capabilities to a ListView Control
How to: Set the Sort Modes for Columns in the Windows Forms DataGridView Control
How to: Set Font and Color Styles in the Windows Forms DataGridView Control
How to: Group Windows Forms RadioButton Controls to Function as a Set
How to: Align a Control to the Edges of Forms
How to: Run an Operation in the Background
How to: Set and Return Numeric Values with the Windows Forms NumericUpDown Control
How to: Control the Insertion Point in a Windows Forms TextBox Control
How to: Expose Properties of Constituent Controls
How to: Disable Buttons in a Button Column in the Windows Forms DataGridView Control
How to: Change the Order of Columns in the Windows Forms DataGridView Control
How to: Create Access Keys with Windows Forms Label Controls
How to: Create a Read-Only Text Box (Windows Forms)
How to: Group Items in a Windows Forms ListView Control
How to: Programmatically Resize Cells to Fit Content in the Windows Forms DataGridView Control
How to: Create an MDI Form with Menu Merging and ToolStrip Controls
How to: Add and Remove Tabs with the Windows Forms TabControl
How to: Put Quotation Marks in a String (Windows Forms)
How to: Add Custom Information to a TreeView or ListView Control (Windows Forms)
How to: Set Alternating Row Styles for the Windows Forms DataGridView Control
How to: Autogenerate Columns in a Data-Bound Windows Forms DataGridView Control
How to: Make Your Control Invisible at Run Time
How to: Create an HTML Document Viewer in a Windows Forms Application
How to: Sort and Filter ADO.NET Data with the Windows Forms BindingSource Component
How to: Link to an Object or Web Page with the Windows Forms LinkLabel Control
How to: Determine Page Properties Using the PageSetupDialog Component
How to: Use the Row Template to Customize Rows in the Windows Forms DataGridView Control
How to: Associate a ContextMenuStrip with a Control
How to: Add and Remove Items from a Windows Forms ComboBox, ListBox, or CheckedListBox Control
How to: Display the PrintDialog Component
How to: Provide Standard Menu Items to a Form
How to: Add Buttons to a ToolBar Control
How to: Add Columns to the Windows Forms ListView Control
How to: Respond to Windows Forms Button Clicks
How to: Change the Appearance of the Windows Forms TabControl
How to: Play a Sound Embedded in a Resource from a Windows Form
How to: Bind a Windows Forms Control to a Factory Object
How to: Play a Beep from a Windows Form
How to: Raise Change Notifications Using a BindingSource and the INotifyPropertyChanged Interface
How to: Perform a Custom Action Based on Changes in a Cell of a Windows Forms DataGridView Control
How to: Run Procedures at Set Intervals with the Windows Forms Timer Component
How to: Add Panels to a StatusBar Control
How to: Enable Reordering of ToolStrip Items at Run Time in Windows Forms
How to: Define an Icon for a ToolBar Button
How to: Develop a Simple Windows Forms Control
How to: Create and Set a Custom Renderer for the ToolStrip Control in Windows Forms
How to: Display an Insertion Mark in a Windows Forms ListView Control
How to: Work with Image Columns in the Windows Forms DataGridView Control
How to: Display Specific Days in Bold with the Windows Forms MonthCalendar Control
How to: Define Z-Ordering of Docked ToolStrip Controls
How to: Format Data in the Windows Forms DataGridView Control
How to: Select Text in the Windows Forms TextBox Control
How to: Specify Default Values for New Rows in the Windows Forms DataGridView Control
How to: Handle Errors That Occur During Data Entry in the Windows Forms DataGridView Control
How to: Remove Autogenerated Columns from a Windows Forms DataGridView Control
How to: Specify the Edit Mode for the Windows Forms DataGridView Control
How to: Set the Image Displayed by a Windows Forms Control
How to: Custom Draw a ToolStrip Control
How to: Bind a Windows Forms Control to a Type
How to: Display Web-Style Links with the Windows Forms RichTextBox Control
How to: Select a Range of Dates in the Windows Forms MonthCalendar Control
How to: Bind Windows Forms Controls to DBNull Database Values
How to: Implement Virtual Mode in the Windows Forms DataGridView Control
How to: Trigger Menu Events for Toolbar Buttons
How to: Size a Windows Forms Label Control to Fit Its Contents
How to: Create a Master/Detail Form Using Two Windows Forms DataGridView Controls
How to: Download a File in the Background
How to: Customize Cells and Columns in the Windows Forms DataGridView Control by Extending Their Behavior and Appearance
How to: Define Resize and Positioning Behavior in a Split Window
How to: Display Icons for the Windows Forms ListView Control
How to: Open Files Using the OpenFileDialog Component
How to: Implement a Form That Uses a Background Operation
How to: Set the Size of Status-Bar Panels
How to: Respond to Clicks in the Windows Forms DataGrid Control
How to: Split a Window Horizontally
How to: Render a Visual Style Element
How to: Attach a ShortCut Menu to a TreeView Node
How to: Anchor and Dock Child Controls in a FlowLayoutPanel Control
How to: Format the Windows Forms DataGrid Control
How to: Customize Data Formatting in the Windows Forms DataGridView Control
How to: Set and Return Dates with the Windows Forms DateTimePicker Control
How to: Add Enhancements to ToolStripMenuItems
How to: Append a MenuStrip to an MDI Parent Window (Windows Forms)
How to: Raise Change Notifications Using the BindingSource ResetItem Method
How to: Set Indents, Hanging Indents, and Bulleted Paragraphs with the Windows Forms RichTextBox Control
How to: Disable Tab Pages
How to: Apply Attributes in Windows Forms Controls
How to: Play a System Sound from a Windows Form
How to: Add a Control to a Tab Page
How to: Get and Set the Current Cell in the Windows Forms DataGridView Control
How to: Implement a HelpLabel Extender Provider
How to: Create and Configure Components in Design Mode
How to: Extend the Appearance and Behavior of Controls in Design Mode
How to: Serialize Collections of Standard Types with the DesignerSerializationVisibilityAttribute
How to: Create a Windows Forms Control That Takes Advantage of Design-Time Features
How to: Implement a Type Converter
How to: Perform Custom Initialization for Controls in Design Mode
How to: Access Design-Time Support in Windows Forms
How to: Adjust the Attributes, Events, and Properties of a Component in Design Mode
How to: Access Design-Time Services
How to: Implement an Extender Provider
How to: Implement a UI Type Editor
How to: Crop and Scale Images
How to: Fill a Shape with a Solid Color
How to: Use a Pen to Draw Lines
How to: Shear Colors
How to: Create Graphics Objects for Drawing
How to: Create a Path Gradient
How to: Translate Image Colors
How to: Enumerate Installed Fonts
How to: Draw Text with GDI
How to: Copy Pixels for Reducing Flicker in Windows Forms
How to: Draw a Sequence of Bézier Splines
How to: Use Hit Testing with a Region
How to: Use Clipping with a Region
How to: Use a Color Matrix to Transform a Single Color
How to: Use Antialiasing with Text
How to: Manually Manage Buffered Graphics
How to: Fill a Shape with an Image Texture
How to: Create Vertical Text
How to: Manually Render Buffered Graphics
How to: Use a Pen to Draw Rectangles
How to: Draw a Line on a Windows Form
How to: Fill Open Figures
How to: Load and Display Bitmaps
How to: Draw Text on a Windows Form
How to: Improve Performance by Avoiding Automatic Scaling
How to: Draw Text at a Specified Location
How to: Load and Display Metafiles
How to: Set Tab Stops in Drawn Text
How to: Create a Private Font Collection
How to: Create a Linear Gradient
How to: Tile a Shape with an Image
How to: Create a Shaped Windows Form
How to: Draw Vertical Text on a Windows Form
How to: Draw a Filled Ellipse on a Windows Form
How to: Create a Pen
How to: Create Figures from Lines, Curves, and Shapes
How to: Align Drawn Text
How to: Create a Solid Brush
How to: Draw Opaque and Semitransparent Lines
How to: Reduce Graphics Flicker with Double Buffering for Forms and Controls
How to: Use a Color Remap Table
How to: Fill a Shape with a Hatch Pattern
How to: Join Lines
How to: Set Pen Width and Alignment
How to: Use a Color Matrix to Set Alpha Values in Images
How to: Rotate, Reflect, and Skew Images
How to: Draw Cardinal Splines
How to: Draw with Opaque and Semitransparent Brushes
How to: Set the Color of a Pen
How to: Render Images with GDI+
How to: Draw a Custom Dashed Line
How to: Construct Font Families and Fonts
How to: Draw a Filled Rectangle on a Windows Form
How to: Apply Gamma Correction to a Gradient
How to: Draw a Line Filled with a Texture
How to: Draw Wrapped Text in a Rectangle
How to: Rotate Colors
How to: Flatten a Curved Path into a Line
How to: Create Thumbnail Images
How to: Draw a Line with Line Caps
How to: Use Compositing Mode to Control Alpha Blending
How to: Draw a Single Bézier Spline
How to: Draw an Outlined Shape
How to: Use Interpolation Mode to Control Image Quality During Scaling
How to: Obtain Font Metrics
How to: Navigate to a URL with the WebBrowser Control
How to: Create an Unbound Windows Forms DataGridView Control
How to: Handle the ContextMenuStrip Opening Event
How to: Create a Resizable Windows Form for Data Entry
How to: Create a Border Around a Windows Forms Control Using Padding
How to: Change the Appearance of the Windows Forms ColorDialog Component
How to: Disable ToolStripMenuItems
How to: Delete or Hide Columns in the Windows Forms DataGrid Control
How to: Reflect Data Source Updates in a Windows Forms Control with the BindingSource
How to: Remove a ToolStripMenuItem from an MDI Drop-Down Menu (Windows Forms)
How to: Determine When Formatting Attributes Change in the Windows Forms RichTextBox Control
How to: Use a Control Rendering Class
How to: Load Files into the Windows Forms RichTextBox Control
How to: Set Icons for the Windows Forms TreeView Control
How to: Create a Professionally Styled ToolStrip Control
How to: Enable Tile View in a Windows Forms ListView Control
How to: Sort the Contents of a Windows Forms ComboBox, ListBox, or CheckedListBox Control
How to: Respond to Windows Forms CheckBox Clicks
How to: Set ToolTips for Controls on a Windows Form at Design Time
How to: Use ToolTips in ToolStrip Controls
How to: Add or Remove Images with the Windows Forms ImageList Component
How to: Implement a Custom ToolStripRenderer
How to: Enable Drag-and-Drop Operations with the Windows Forms RichTextBox Control
How to: Bind Objects to Windows Forms DataGridView Controls
How to: View Errors Within a DataSet with the Windows Forms ErrorProvider Component
How to: Enable Column Reordering in the Windows Forms DataGridView Control
How to: Change the Spacing and Alignment of ToolStrip Items in Windows Forms
How to: Display Scroll Bars in the Windows Forms RichTextBox Control
How to: Create Variable Sized Text in a ComboBox Control
How to: Change the Windows Forms MonthCalendar Control's Appearance
How to: Modify the Size or Placement of a Picture at Run Time (Windows Forms)
How to: Add a ToolStripContainer to a Form
How to: Create a Password Text Box with the Windows Forms TextBox Control
How to: Validate Data in the Windows Forms DataGridView Control
How to: Design a Windows Forms Layout that Responds Well to Localization
How to: Determine Which Panel in the Windows Forms StatusBar Control Was Clicked
How to: Display More than One Month in the Windows Forms MonthCalendar Control
How to: Create an MDI Form with ToolStripPanel Controls
How to: Add Application Icons to the TaskBar with the Windows Forms NotifyIcon Component
How to: Detect When the Mouse Pointer Is Over a ToolStripItem
How to: Customize the Appearance of Rows in the Windows Forms DataGridView Control
How to: Change the Appearance of ToolStrip Text and Images in Windows Forms
How to: Associate a Shortcut Menu with a Windows Forms NotifyIcon Component
How to: Use ToolStripPanels for MDI
How to: Manipulate Columns in the Windows Forms DataGridView Control
How to: Get the Selected Cells, Rows, and Columns in the Windows Forms DataGridView Control
How to: Create Toggle Buttons in ToolStrip Controls
How to: Select an Item in the Windows Forms ListView Control
How to: Add and Remove Nodes with the Windows Forms TreeView Control
How to: Bind a Windows Forms ComboBox or ListBox Control to Data
How to: Customize Colors in ToolStrip Applications
How to: Wrap a Windows Forms Control with ToolStripControlHost
How to: Display Print Preview in Windows Forms Applications
How to: Display Subitems in Columns with the Windows Forms ListView Control
How to: Hide Column Headers in the Windows Forms DataGridView Control
How to: Remove Items from Windows Forms DomainUpDown Controls
How to: Host Controls in Windows Forms DataGridView Cells
How to: Create a Multipane User Interface with Windows Forms
How to: Set the Sizing Modes of the Windows Forms DataGridView Control
How to: Loop a Sound Playing on a Windows Form
How to: Enable Check Margins and Image Margins in ContextMenuStrip Controls
How to: Handle Errors and Exceptions that Occur with Databinding
How to: Show a Color Palette with the ColorDialog Component
How to: Bind to a Web Service Using the Windows Forms BindingSource
How to: Prevent Row Addition and Deletion in the Windows Forms DataGridView Control
How to: Validate Input with the Windows Forms DataGrid Control
How to: Add an Unbound Column to a Data-Bound Windows Forms DataGridView Control
How to: Implement a Custom Layout Engine
How to: Manage ToolStrip Overflow in Windows Forms
How to: Add a Control to a ToolStripContentPanel
How to: Set the Format for the Windows Forms NumericUpDown Control
How to: Enable Users to Copy Multiple Cells to the Clipboard from the Windows Forms DataGridView Control
How to: Add Items to Windows Forms DomainUpDown Controls Programmatically
How to: Enable AutoComplete in ToolStrip Controls in Windows Forms
How to: Change the Appearance of the Windows Forms LinkLabel Control
How to: Implement a Client of the Event-based Asynchronous Pattern
How to: Use Components That Support the Event-based Asynchronous Pattern
How to: Implement a Component That Supports the Event-based Asynchronous Pattern
How to: Implement a HelpLabel Extender Provider
How to: Create and Configure Components in Design Mode
How to: Extend the Appearance and Behavior of Controls in Design Mode
How to: Serialize Collections of Standard Types with the DesignerSerializationVisibilityAttribute
How to: Create a Windows Forms Control That Takes Advantage of Design-Time Features
How to: Implement a Type Converter
How to: Perform Custom Initialization for Controls in Design Mode
How to: Access Design-Time Support in Windows Forms
How to: Adjust the Attributes, Events, and Properties of a Component in Design Mode
How to: Access Design-Time Services
How to: Implement an Extender Provider
How to: Implement a UI Type Editor
How to: Create Threads
How to: Log Events for Multithreaded Components
How to: Display Forms from Components
How to: Create Component Containers
How to: License Components and Controls
How to: Specify a Help File for Your Component
How to: Manipulate Controls from Threads
How to: Coordinate Multiple Threads of Execution
How to: Extend Component Containers
How to: Provide Metadata for Component Properties, Methods, and Events
code munging
How to: Create Standard Windows Forms Print Jobs
Windows Forms Community Support
How to: Determine Which Modifier Key Was Pressed
How to: Create Application Settings
How to: Complete Windows Forms Print Jobs
How to: Add Data to the Clipboard
How to: Create Event Handlers at Run Time for Windows Forms
How to: Print Graphics in Windows Forms
How to: Print a Multi-Page Text File in Windows Forms
How to: Handle User Input Events in Windows Forms Controls
How to: Capture User Input from a PrintDialog at Run Time
How to: Create a Windows Forms Application from the Command Line
How to: Respond to Font Scheme Changes in a Windows Forms Application
How to: Support COM Interop by Displaying Windows Forms on a Shared Thread
How to: Connect Multiple Events to a Single Event Handler in Windows Forms
How to: Resize Windows Forms
How to: Modify Keyboard Input to a Standard Control
How to: Navigate Data in Windows Forms
How to: Choose the Printers Attached to a User's Computer in Windows Forms
Change Notification in Windows Forms Data Binding
How to: Simulate Mouse and Keyboard Events in Code
How to: Support COM Interop by Displaying a Windows Form with the ShowDialog Method
How to: Retrieve Data from the Clipboard
How to: Validate Application Settings
How to: Support COM Interop by Displaying Each Windows Form on Its Own Thread
How to: Display Dialog Boxes for Windows Forms
How to: Change the Borders of Windows Forms
How to: Handle Keyboard Input at the Form Level
How to: Distinguish Between Clicks and Double-Clicks
How to: Perform Drag-and-Drop Operations Between Applications
How to: Crop and Scale Images
How to: Fill a Shape with a Solid Color
How to: Use a Pen to Draw Lines
How to: Shear Colors
How to: Create Graphics Objects for Drawing
How to: Create a Path Gradient
How to: Translate Image Colors
How to: Enumerate Installed Fonts
How to: Draw Text with GDI
How to: Copy Pixels for Reducing Flicker in Windows Forms
How to: Draw a Sequence of Bézier Splines
How to: Use Hit Testing with a Region
How to: Use Clipping with a Region
How to: Use a Color Matrix to Transform a Single Color
How to: Use Antialiasing with Text
How to: Manually Manage Buffered Graphics
How to: Fill a Shape with an Image Texture
How to: Create Vertical Text
How to: Manually Render Buffered Graphics
How to: Use a Pen to Draw Rectangles
How to: Draw a Line on a Windows Form
How to: Fill Open Figures
How to: Load and Display Bitmaps
How to: Draw Text on a Windows Form
How to: Improve Performance by Avoiding Automatic Scaling
How to: Draw Text at a Specified Location
How to: Load and Display Metafiles
How to: Set Tab Stops in Drawn Text
How to: Create a Private Font Collection
How to: Create a Linear Gradient
How to: Tile a Shape with an Image
How to: Create a Shaped Windows Form
How to: Add a Trusted Publisher to a Client Computer for ClickOnce Applications
How to: Retrieve Query String Information in a ClickOnce Application
How to: Specify an Alternate Location for Deployment Updates
How to: Include a Data File in a ClickOnce Application
How to: Save Files Using the SaveFileDialog Component
How to: Create an MDI Window List with MenuStrip (Windows Forms)
How to: Determine Which TreeView Node Was Clicked (Windows Forms)
How to: Change the Delay of the Windows Forms ToolTip Component
How to: Set the Background of a Windows Forms Panel
How to: Display Time with the DateTimePicker Control
How to: Change Displayed Data at Run Time in the Windows Forms DataGrid Control
How to: Anchor and Dock Child Controls in a TableLayoutPanel Control
How to: Access Objects Bound to Windows Forms DataGridView Rows
How to: Set the Value Displayed by the Windows Forms ProgressBar Control
How to: Navigate Data with the Windows Forms BindingNavigator Control
How to: Add ToolStrip Items Dynamically
How to: Insert a MenuStrip into an MDI Drop-Down Menu (Windows Forms)
How to: Position a ToolStripItem on a ToolStrip
How to: Access Specific Items in a Windows Forms ComboBox, ListBox, or CheckedListBox Control
How to: Bind the Windows Forms DataGrid Control to a Data Source
How to: Make Thread-Safe Calls to Windows Forms Controls
How to: Move Through a DataSet with the Windows Forms BindingNavigator Control
How to: Change Styles on an Element in the Managed HTML Document Object Model
How to: Bind Data to the Windows Forms DataGridView Control
How to: Determine Checked Items in the Windows Forms CheckedListBox Control
How to: Use the Spring Property Interactively in a StatusStrip
How to: Set Pictures at Run Time (Windows Forms)
How to: Set Default Cell Styles for the Windows Forms DataGridView Control
How to: Customize Item Addition with the Windows Forms BindingSource
How to: Add and Remove Items with the Windows Forms ListView Control
How to: Automatically Resize Cells When Content Changes in the Windows Forms DataGridView Control
How to: Manipulate Bands in the Windows Forms DataGridView Control
How to: Add Menu Items to a ContextMenuStrip
How to: Create Master/Detail Lists with the Windows Forms DataGrid Control
How to: Designate a Windows Forms Button as the Accept Button
How to: Create a Windows Forms Control That Shows Progress
How to: Designate a Windows Forms Button as the Cancel Button
How to: Add ToolTips to Individual Cells in a Windows Forms DataGridView Control
How to: Set Options with Windows Forms CheckBox Controls
How to: Make Columns Read-Only in the Windows Forms DataGridView Control
How to: Set Font Attributes for the Windows Forms RichTextBox Control
How to: Freeze Columns in the Windows Forms DataGridView Control
How to: Set the Selection Mode of the Windows Forms DataGridView Control
How to: Change the Border and Gridline Styles in the Windows Forms DataGridView Control
How to: Add Tables and Columns to the Windows Forms DataGrid Control
How to: Give Your Control a Transparent Background
How to: Implement Virtual Mode with Just-In-Time Data Loading in the Windows Forms DataGridView Control
How to: Draw Vertical Text on a Windows Form
How to: Configure ContextMenuStrip Check Margins and Image Margins
How to: Bind Data to the MaskedTextBox Control
How to: Show a Font List with the FontDialog Component

Windowless Controls

The Microsoft Visual Basic® 6.0and ActiveX technologies support windowless controls. Windowless controls are not supported in Windows Forms.

Custom Design Experience

If you need to implement a custom design-time experience, you can author your own designer. For composite controls, derive your custom designer class from the ParentControlDesigner or the DocumentDesigner classes. For extended and custom controls, derive your custom designer class from the ControlDesigner class.

Use the DesignerAttribute to associate your control with your designer. For more information, see Extending Design-Time Support and How to: Create a Windows Forms Control That Takes Advantage of Design-Time Features.

See Also

Community Additions

ADD
Show: