HOWTO: Create Non-rectangular Windows

ID: Q125669

The information in this article applies to:

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.

Additional query words:

Keywords          : kbNTOS351 kbNTOS400 kbGrpUser kbWinOS95 kbWinOS98 kbWndw kbWndwProp 
Issue type        : kbhowto

Last Reviewed: January 2, 1999