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_OperatorPlus(HDC hdc)
{
   Graphics graphics(hdc);
   Pen pen(Color(255, 0, 0, 0));

   Size size1(80, 30);
   Size size2(50, 20);
   
   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