Information
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.

DrawFocusRect function

The DrawFocusRect function draws a rectangle in the style used to indicate that the rectangle has the focus.

Syntax


BOOL DrawFocusRect(
  _In_  HDC hDC,
  _In_  const RECT *lprc
);

Parameters

hDC [in]

A handle to the device context.

lprc [in]

A pointer to a RECT structure that specifies the logical coordinates of the rectangle.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Remarks

DrawFocusRect works only in MM_TEXT mode.

Because DrawFocusRect is an XOR function, calling it a second time with the same rectangle removes the rectangle from the screen.

This function draws a rectangle that cannot be scrolled. To scroll an area containing a rectangle drawn by this function, call DrawFocusRect to remove the rectangle from the screen, scroll the area, and then call DrawFocusRect again to draw the rectangle in the new position.

Windows XP: The focus rectangle can now be thicker than 1 pixel, so it is more visible for high-resolution, high-density displays and accessibility needs. This is handled by the SPI_SETFOCUSBORDERWIDTH and SPI_SETFOCUSBORDERHEIGHT in SystemParametersInfo.

Examples

For an example, see "Creating an Owner-Drawn List Box" in Using List Boxes.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Painting and Drawing Overview
Painting and Drawing Functions
FrameRect
RECT

 

 

Community Additions

Show:
© 2014 Microsoft