[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'InterfaceBase' (#lcl)

# TWidgetSet.RedrawWindow

Redraws (part of) a window.

## Declaration

Source position: winapih.inc line 223

`public function TWidgetSet.RedrawWindow(`
`Wnd: HWND;`
`lprcUpdate: PRect;`
`hrgnUpdate: HRGN;`
`flags: UINT`
`):Boolean; virtual;`

## Arguments

`Wnd` |  | The window to redraw.
`lprcUpdate` |  | The rectangle to redraw, ignored when a region is given.
`hrgnUpdate` |  | The region to redraw, can be zero.
`flags` |  | How the redraw works.

## Function result

False on failure.

## Description

All invalidated parts of a window, which deserve an update, are collected in the update region. When this region is not empty, WM_ERASEBKGND, WM_PAINT and WM_NCPAINT messages are sent to the window, as soon as the application is (almost) idle. RedrawWindow can be used to force an immediate redraw instead.

WM_ERASEBKGND is optional, erases the background before painting. WM_NCPAINT paints the non-client areas (borders, caption...), without assistance by user code.

When neither lprcUpdate nor hrgnUpdate are specified, the whole client area of the window is affected. Otherwise the region takes precedence over the rectangle.

Flags specify how the window is invalidated or validated, and when repainting occurs. Flags other than RDW_ERASE may not be supported by all platforms.

To invalidate specify RDW_INVALIDATE, and optionally one of:

RDW_ERASE
  Forces a WM_ERASEBKGND message before painting.
RDW_FRAME
  Also redraws the window frame, as covered by the update region.
RDW_INTERNALPAINT
  Force WM_PAINT even if the update region is empty.

Validation is not implemented for all platforms. To validate, specify RDW_VALIDATE and optionally one of the following:

RDW_NOERASE
  Suppress all pending WM_ERASEBKGND messages.
RDW_NOFRAME
  Suppress all pending WM_NCPAINT messages.
RDW_NOINTERNALPAINT
  Suppress all pending internal WM_PAINT messages.

These flags specify when repainting will occur:

RDW_ERASENOW
  Send WM_ERASEBKGND messages before returning.
RDW_UPDATENOW
  Send WM_PAINT messages before returning.

The handling of child windows normally depends on the WS_CLIPCHILDREN window style flag. Clipped child windows are not normally affected by RedrawWindow. These flags override:

RDW_ALLCHILDREN
  Include all child windows.
RDW_NOCHILDREN
  Exclude all child windows.

## See also

TWidgetSet.InvalidateRect |  | Marks a display area for repaint.
TWidgetSet.InvalidateRgn |  | Marks a display area for repaint.