mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-04 09:06:04 +02:00
* 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
1.9 KiB
1.9 KiB
title, description, ms.date, dev_langs, f1_keywords, helpviewer_keywords, ms.assetid
| title | description | ms.date | dev_langs | f1_keywords | helpviewer_keywords | ms.assetid | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| How to: Draw a Line on a Windows Form | Learn how to draws a line on a form by handling the Paint event, and then perform the drawing using the Graphics property of the PaintEventArgs. | 03/30/2017 |
|
|
|
55c1dbeb-75d0-430c-9814-a24b8971ad8c |
How to: Draw a Line on a Windows Form
This example draws a line on a form. Typically, when you draw on a form, you handle the form’s xref:System.Windows.Forms.Control.Paint event and perform the drawing using the xref:System.Windows.Forms.PaintEventArgs.Graphics%2A property of the xref:System.Windows.Forms.PaintEventArgs, as shown in this example
Example
[!code-csharpSystem.Drawing.UsingAPen#11] [!code-vbSystem.Drawing.UsingAPen#11]
Compiling the Code
The preceding example is designed for use with Windows Forms, and it requires xref:System.Windows.Forms.PaintEventArgse, which is a parameter of the xref:System.Windows.Forms.Control.Paint event handler.
Robust Programming
You should always call xref:System.IDisposable.Dispose%2A on any objects that consume system resources, such as xref:System.Drawing.Pen objects.