Graphics.TranslateClip(REAL, REAL) method

Applies to: desktop apps only

The Graphics::TranslateClip method translates the clipping region of this Graphics object.

Syntax

Status TranslateClip(
  [in]  REAL dx,
  [in]  REAL dy
);

Parameters

  • dx [in]
    Type: REAL

    Real number that specifies the horizontal component of the translation.

  • dy [in]
    Type: REAL

    Real number that specifies the vertical component of the translation.

Return value

Type:

Type: Status****

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

Examples

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.

VOID Example_TranslateClipReal(HDC hdc)
{
   Graphics graphics(hdc);

   // Set the clipping region.
   graphics.SetClip(RectF(0.0f, 0.0f, 100.0f, 50.0f));

   // Translate the clipping region.
   graphics.TranslateClip(40.0f, 30.0f);

   // Fill an ellipse that is clipped by the translated clipping region.
   SolidBrush brush(Color(255, 255, 0, 0));
   graphics.FillEllipse(&brush, 20, 40, 100, 80);

   // Draw the outline of the clipping region (rectangle).
   Pen pen(Color(255, 0, 0, 0), 2.0f);
   graphics.DrawRectangle(&pen, 40, 30, 100, 50);
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusgraphics.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Graphics

Graphics::GetClip

IntersectClip Methods

Graphics::IsClipEmpty

SetClip Methods

Clipping with a Region

Clipping

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012