* Merge winforms framework content to working branch (#14) * Breadcrumb / TOC / Move net5 to net folder (#15) * change path from net5 to net * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Mess with bread/toc * Add .net 5 winforms placeholder article (#16) * added some metadata and adjusted net5 placeholder * corrections * corrections * corrections * Test1 * Swapping landing page vs concept * fix links * Fix links * Fix desc
2.3 KiB
title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
| title | ms.date | dev_langs | helpviewer_keywords | ms.assetid | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| How to: Use a Control Rendering Class | 03/30/2017 |
|
|
c0125e34-cd74-4c35-818c-3e40f462b0a3 |
How to: Use a Control Rendering Class
This example demonstrates how to use the xref:System.Windows.Forms.ComboBoxRenderer class to render the drop-down arrow of a combo box control. The example consists of the xref:System.Windows.Forms.Control.OnPaint%2A method of a simple custom control. The xref:System.Windows.Forms.ComboBoxRenderer.IsSupported%2A?displayProperty=nameWithType property is used to determine whether visual styles are enabled in the client area of application windows. If visual styles are active, then the xref:System.Windows.Forms.ComboBoxRenderer.DrawDropDownButton%2A?displayProperty=nameWithType method will render the drop-down arrow with visual styles; otherwise, the xref:System.Windows.Forms.ControlPaint.DrawComboButton%2A?displayProperty=nameWithType method will render the drop-down arrow in the classic Windows style.
Example
[!code-cppSystem.Windows.Forms_ControlRenderer#10] [!code-csharpSystem.Windows.Forms_ControlRenderer#10] [!code-vbSystem.Windows.Forms_ControlRenderer#10]
Compiling the Code
This example requires:
-
A custom control derived from the xref:System.Windows.Forms.Control class.
-
A xref:System.Windows.Forms.Form that hosts the custom control.
-
References to the xref:System?displayProperty=nameWithType, xref:System.Drawing?displayProperty=nameWithType, xref:System.Windows.Forms?displayProperty=nameWithType, and xref:System.Windows.Forms.VisualStyles?displayProperty=nameWithType namespaces.