How To Create Nonrectangular Windows (125669)



The information in this article applies to:

  • Microsoft Platform Software Development Kit (SDK) 1.0
  • Microsoft Windows 2000 Driver Development Kit (DDK)

This article was previously published under Q125669

SUMMARY

Windows provides an API called SetWindowRgn() that makes it easy for applications to create irregularly shaped windows.

MORE INFORMATION

In previous versions of Windows and Windows NT, it was possible to create only rectangular windows. To simulate a non-rectangular window required a lot of work on the application developer's part. Besides handling all drawing for the window, the application was required to perform hit-testing and force underlying windows to repaint as necessary to refresh the "transparent" portions of the window.

Windows 95 and Windows NT version 3.51 greatly simplify this by providing the SetWindowRgn function. An application can now create a region with any desired shape and use SetWindowRgn to set this as the clipping region for the window. Subsequent painting and mouse messages are limited to this region, and Windows automatically updates underlying windows that show through the non-rectangular window. The application need only paint the window as desired.

For more information on using SetWindowRgn, see the Win32 API documentation.

Modification Type:MinorLast Reviewed:7/11/2005
Keywords:kbhowto kbWndw kbWndwProp KB125669