Share via


Graphics::TranslateClip (REAL,REAL) 方法 (gdiplusgraphics.h)

Graphics::TranslateClip 方法會轉譯此 Graphics 物件的裁剪區域。

語法

Status TranslateClip(
  REAL dx,
  REAL dy
);

參數

dx

指定翻譯水準元件的實數。

dy

指定翻譯垂直元件的實數。

傳回值

如果方法成功,它會傳回 Ok,這是 Status 列舉的元素。

如果方法失敗,它會傳回 Status 列舉的其他其中一個專案。

備註

範例

下列範例會測量字串的大小,然後繪製代表該大小的矩形。

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);
}

規格需求

需求
標頭 gdiplusgraphics.h

另請參閱

裁剪

使用區域裁剪

圖形

Graphics::GetClip

Graphics::IsClipEmpty

IntersectClip 方法

SetClip 方法