次の方法で共有


SizeF.operator-(const SizeF) method

Applies to: desktop apps only

The SizeF::operator- method subtracts the Width and Height data members of two SizeF objects.

Syntax

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

Parameters

  • sz [in, ref]
    Type: const SizeF

    Reference to a SizeF object whose Width and Height data members are subtracted from the Width and Height data members of this SizeF object.

Return value

Type:

Type: SizeF****

This method returns the difference of this SizeF object and another SizeF object.

Remarks

This method overloads the subtraction operator for SizeF objects. If A, B, and C are Size objects, the statement C = A - B is equivalent to C = A.operator-(B).

Examples

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

   SizeF size1(200.0f, 100.0f);
   SizeF size2(50.0f, 40.0f);
   
   SizeF size3 = size1 - size2;

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

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplustypes.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

SizeF

SizeF::operator+

Size

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012