Help Center

CGpGraphics.TranslateClipmethod

Translates the clipping region of this **Graphics** object.

GraphicsmethodCGpGraphics.incdocumented

Syntax

FUNCTION TranslateClip (BYVAL dx AS SINGLE, BYVAL dy AS SINGLE) AS GpStatus

Parameters

NameDescription
dxThe horizontal component of the translation.
dyThe vertical component of the translation.

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

Translates the clipping region of this Graphics object.

Example

' ======================================================================================== ' The following example creates a Graphics object and sets its clipping region. The code ' translates the clipping region 100 units to the right and then fills a large rectangle ' that is clipped by the translated region. ' ======================================================================================== SUB Example_TranslateClip (BYVAL hdc AS HDC)

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

' // Set the clipping region. graphics.SetClip(0, 0, 100, 50)

' // Translate the clipping region. graphics.TranslateClip(40, 30)

' // Fill an ellipse that is clipped by the translated clipping region. DIM redBrush AS CGpSolidBrush = CGpSolidBrush(ARGB_RED) graphics.FillEllipse(@redBrush, 20, 40, 100, 80)

' // Draw the outline of the clipping region (rectangle). DIM blackPen AS CGpPen = CGpPen(ARGB_BLACK, 2) graphics.DrawRectangle(@blackPen, 40, 30, 100, 50)

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

Reference

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