Share via


Graphics::ResetTransform 方法 (gdiplusgraphics.h)

Graphics::ResetTransform 方法會將此 Graphics 物件的世界轉換矩陣設定為識別矩陣。

Syntax

Status ResetTransform();

傳回值

類型: 狀態

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

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

備註

識別矩陣代表不執行任何動作的轉換。 如果 Graphics 物件的世界轉換矩陣是識別矩陣,則不會將世界轉換套用至該 Graphics 物件所繪製的專案。

範例

下列範例會將 Graphics 物件的世界轉換設定為 45 度旋轉,然後繪製矩形。 程序代碼會呼叫 Graphics 物件的ResetTransform 方法,然後繪製第二個矩形。 不會將旋轉轉換套用至第二個矩形。

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

   // Rotate the transformation and draw a rectangle.
   graphics.RotateTransform(45.0f);
   Pen blackPen(Color(255, 0, 0, 0));
   graphics.DrawRectangle(&blackPen, 100, 0, 100, 50);

   // Reset the transformation to identity, and draw a second rectangle.
   graphics.ResetTransform();
   Pen redPen(Color(255, 255, 0, 0));
   graphics.DrawRectangle(&redPen, 110, 0, 100, 50);
}

規格需求

需求
最低支援的用戶端 Windows XP、Windows 2000 Professional [僅限傳統型應用程式]
最低支援的伺服器 Windows 2000 Server [僅限傳統型應用程式]
目標平台 Windows
標頭 gdiplusgraphics.h (包含 Gdiplus.h)
程式庫 Gdiplus.lib
Dll Gdiplus.dll

另請參閱

座標系統和轉換

圖形

Graphics::GetTransform

Graphics::MultiplyTransform

Graphics::RotateTransform

Graphics::ScaleTransform

Graphics::SetTransform

Graphics::TransformPoints

Graphics::TranslateTransform

矩陣

MatrixOrder

轉換