Files
Andy De George c0ba284473 Initial winforms content migrated (#18)
* 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
2020-09-01 16:26:21 -07:00

1.9 KiB
Raw Permalink Blame History

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
csharp
vb
Graphics.DrawLine
examples [Windows Forms], drawing lines on forms
drawing [Windows Forms], lines
lines [Windows Forms], drawing
drawing lines
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 forms 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.

See also