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.
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.
To draw with clipping, create a Graphics object, set its Clip property, and then call the drawing methods of that same Graphics object:
myGraphics.Clip = myRegion;
myGraphics.DrawLine(myPen, 0, 0, 200, 200);
myGraphics.Clip = myRegion
myGraphics.DrawLine(myPen, 0, 0, 200, 200)
See also
Met ons samenwerken op GitHub
De bron voor deze inhoud vindt u op GitHub, waar u ook problemen en pull-aanvragen kunt maken en controleren. Bekijk onze gids voor inzenders voor meer informatie.
.NET Desktop feedback