FrameRect function (winuser.h)

The FrameRect function draws a border around the specified rectangle by using the specified brush. The width and height of the border are always one logical unit.


int FrameRect(
  [in] HDC        hDC,
  [in] const RECT *lprc,
  [in] HBRUSH     hbr


[in] hDC

A handle to the device context in which the border is drawn.

[in] lprc

A pointer to a RECT structure that contains the logical coordinates of the upper-left and lower-right corners of the rectangle.

[in] hbr

A handle to the brush used to draw the border.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.


The brush identified by the hbr parameter must have been created by using the CreateHatchBrush, CreatePatternBrush, or CreateSolidBrush function, or retrieved by using the GetStockObject function.

If the bottom member of the RECT structure is less than the top member, or if the right member is less than the left member, the function does not draw the rectangle.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-gui-l1-1-1 (introduced in Windows 8.1)

See also




Filled Shape Functions

Filled Shapes Overview