SetBoundsRect

  WORD SetBoundsRect(hdc, lprcBounds, flags)    
  HDC hdc; /* handle of device context */
  LPRECT lprcBounds; /* points to new bounds rectangle */
  WORD flags; /* controls rectangle combination */

The SetBoundsRect function controls the accumulation of bounding-rectangle information for the specified device context. Windows can maintain a bounding rectangle for all drawing operations, which can be queried and reset by the application. The drawing bounds are useful for invalidating bitmap caches.

Parameters

hdc

Identifies the device context to accumulate bounding rectangles for.

lprcBounds

Points to the rectangle (in logical coordinates) to set the bounds rectangle to. This parameter may be NULL.

flags

Specifies how the new rectangle will be combined with the accumulated rectangle. This parameter may be some combination of the following values:

Value Meaning

DCB_RESET  
  Make the bounding rectangle empty.
DCB_ACCUMULATE  
  Takes the rectangle at lprcBounds and adds it to the bounding rectangle (via a rectangle Union operation). Note that using both DCB_RESET and DCB_ACCUMULATE will set the DC bounding rectangle to the rectangle specified by the lprcBounds parameter.
DCB_ENABLE  
  Turn on bounds accumulation. Bounds accumulation is disabled by default.
DCB_DISABLE  
  Turn off bounds accumulation.

Return Value

The return value specifies the current bounds rectangle state. It may be some combination of the following values:

Value Meaning

DCB_ACCUMULATE Bounds rectangle accumulation is occurring.
DCB_RESET The bounds rectangle is empty.
DCB_SET The bounds rectangle is not empty.
DCB_ENABLE Bounds accumulation is on.
DCB_DISABLE Bounds accumulation is off.

Comment

To be sure the bounds rectangle is empty, you must check both the DCB_RESET bit and the DCB_ACCUMULATE flag in the return value. If the DCB_RESET flag is on and the DCB_ACCUMULATE flag is OFF, the bounds rectangle is empty.

See Also

GetBoundsRect