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.6 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
Restricting the Drawing Surface in GDI+ 03/30/2017
csharp
vb
GDI+, clipping
clipping [Windows Forms], using GDI+
GDI+, restricting drawing surface
8b5f71d9-d2f0-4540-9c41-740f90fd4c26

Restricting the Drawing Surface in GDI+

Clipping involves restricting drawing to a certain rectangle or region. The following illustration shows the string "Hello" clipped to a heart-shaped region.

Restricted Drawing Surface

Clipping with Regions

Regions can be constructed from paths, and paths can contain the outlines of strings, so you can use outlined text for clipping. The following illustration shows a set of concentric ellipses clipped to the interior of a string of text.

Restricted Drawing Surface

To draw with clipping, create a xref:System.Drawing.Graphics object, set its xref:System.Drawing.Graphics.Clip%2A property, and then call the drawing methods of that same xref:System.Drawing.Graphics object:

[!code-csharpLinesCurvesAndShapes#91] [!code-vbLinesCurvesAndShapes#91]

See also