Help Center

CGpGraphics.SetClipmethod

Updates the clipping region of this **Graphics** object to a region that is the combination of itself and the clipping region of another **Graphics** object.

GraphicsmethodCGpGraphics.incdocumented

Syntax

FUNCTION SetClip (BYVAL pGraphics AS CGpGraphics PTR, BYVAL nCombineMode AS CombineMode = CombineModeReplace) AS GpStatus
FUNCTION SetClip (BYVAL rc AS GpRectF PTR, BYVAL nCombineMode AS CombineMode = CombineModeReplace) AS GpStatus
FUNCTION SetClip (BYVAL rc AS GpRect PTR, BYVAL nCombineMode AS CombineMode = CombineModeReplace) AS GpStatus
FUNCTION SetClip (BYVAL x AS SINGLE, BYVAL y AS SINGLE, BYVAL nWidth AS SINGLE, BYVAL nHeight AS SINGLE, BYVAL nCombineMode AS CombineMode = CombineModeReplace) AS GpStatus
FUNCTION SetClip (BYVAL x AS INT_, BYVAL y AS INT_, BYVAL nWidth AS INT_, BYVAL nHeight AS INT_, BYVAL nCombineMode AS CombineMode = CombineModeReplace) AS GpStatus
FUNCTION SetClip (BYVAL pPath AS CGpGraphicsPath PTR, BYVAL nCombineMode AS CombineMode = CombineModeReplace) AS GpStatus
FUNCTION SetClip (BYVAL pRegion AS CGpRegion PTR, BYVAL nCombineMode AS CombineMode = CombineModeReplace) AS GpStatus
FUNCTION SetClip (BYVAL hRgn AS HRGN, BYVAL nCombineMode AS CombineMode = CombineModeReplace) AS GpStatus

Parameters

NameDescription
pGraphicsPointer to a Graphics object that contains the clipping region to be combined with the clipping region of this Graphics object.
combineModeOptional. Element of the CombineMode enumeration that specifies how the specified region is combined with the clipping region of this Graphics object. The default value is CombineModeReplace.
hRgnHandle to a GDI region to be combined with the clipping region of this Graphics object. This is provided for legacy code. New applications should pass a Region object as the first parameter.
pRegionPointer to a Region object that specifies the region to be combined with the clipping region of this Graphics object.
pPathPointer to a GraphicsPath object that specifies the region to be combined with the clipping region of this Graphics object.
rcReference to a rectangle to be combined with the clipping region of this Graphics object.

Return value

If the function succeeds, it returns StatusOk, which is an element of the GpStatus enumeration.

If the function fails, it returns one of the other elements of the GpStatus enumeration.

Description

Updates the clipping region of this Graphics object to a region that is the combination of itself and the clipping region of another Graphics object.

Example

' ======================================================================================== ' The following example updates the clipping region with a Rect structure and then fills a rectangle. ' ======================================================================================== SUB Example_SetClip (BYVAL hdc AS HDC)

' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi

' // Create a Rect object. DIM clipRect AS GpRectF = (0, 0, 200, 100)

' // Set the clipping region graphics.SetClip(@clipRect)

' // Fill a rectangle to demonstrate the clipping region. graphics.FillRectangle(@CGpSolidBrush(ARGB_BLACK), 10, 10, 500, 500)

END SUB ' ========================================================================================

Reference

  • Include file CGpGraphics.inc
  • Defined in AfxNova/CGpGraphics.inc:1260
  • Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
  • Topic: CGpGraphics Class