Size::operator- メソッド (gdiplustypes.h)

Size::operator- メソッドは、2 つの Size オブジェクトの Width データ メンバーと Height データ メンバーを減算します。

構文

Size operator-(
  [in, ref] const Size & sz
);

パラメーター

[in, ref] sz

型: const Size

Width および Height データ メンバーがこの Size オブジェクトの Width および Height データ メンバーから減算される Size オブジェクトへの参照。

戻り値

種類: サイズ

このメソッドは、この Size オブジェクトと別の Size オブジェクトの違い 返します。

解説

このメソッドは、 Size オブジェクトの減算演算子をオーバーロードします。 A、B、および C が Size オブジェクトの場合、ステートメント C = A - BC = A.operator-(B) に相当します。

VOID Example_OperatorMinus(HWND hWnd)
{
   Graphics graphics(hdc);
   Pen pen(Color(255, 0, 0, 0));

   Size size1(200, 100);
   Size size2(50, 40);
   
   Size size3 = size1 - size2;

   graphics.DrawRectangle(&pen, 50, 50, size1.Width, size1.Height);
   graphics.DrawRectangle(&pen, 50, 50, size2.Width, size2.Height);
   graphics.DrawRectangle(&pen, 50, 50, size3.Width, size3.Height);
}

要件

   
サポートされている最小のクライアント Windows XP、Windows 2000 Professional [デスクトップ アプリのみ]
サポートされている最小のサーバー Windows 2000 Server [デスクトップ アプリのみ]
対象プラットフォーム Windows
ヘッダー gdiplustypes.h (Gdiplus.h を含む)
Library Gdiplus.lib
[DLL] Gdiplus.dll

関連項目

[サイズ]

Size::operator+

Sizef