Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.


Stores an ordered pair of integers, typically the width and height of a rectangle.

typedef D2D_SIZE_U D2D1_SIZE_U;


Like points, sizes are another important graphics concept. In Direct2D, sizes are represented by the D2D1_SIZE_U or D2D1_SIZE_F structures. They both contain an ordered pair of numbers. The D2D1_SIZE_U structure contains an ordered pair of UINT32 values, and the D2D1_SIZE_F structure contains an ordered pair of FLOAT values.

The D2D1_SIZE_U structure provides a convenient way for you to store an ordered pair of numbers, such as the width and height of a rectangle.

D2D1_SIZE_U is a new name for an already defined type D2D_SIZE_U. You can use the D2D1::SizeU function to create a D2D1_SIZE_U structure. A common use for this structure is to specify the pixel size of a D2D1_HWND_RENDER_TARGET_PROPERTIES structure. The following provides an example of using this structure.

    if (!m_pRenderTarget)
        RECT rc;
        GetClientRect(m_hwnd, &rc);

        D2D1_SIZE_U size = D2D1::SizeU(
            rc.right - rc.left,
            rc.bottom -

        // Create a Direct2D render target.
        hr = m_pD2DFactory->CreateHwndRenderTarget(
            D2D1::HwndRenderTargetProperties(m_hwnd, size),


Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]


D2DBaseTypes.h (include D2d1.h)

See also




© 2017 Microsoft