February 27, 2021
Hot Topics:

Creating Odd Shaped Forms

  • By John Percival
  • Send Email »
  • More Articles »

Odd shaped forms are a great novelty for splash screens and about boxes. They are fun for the user, but are a little tricky to create. The whole idea is that odd shaped forms are based around regions: an area, in the shape of a rectangle, ellipse, or polygon, which can be combined with other regions to form very complex shapes.

The Windows API allows you to create these regions, returning a handle to the region. This is effectively an 'address' to the region. If we want to know about the region, pass Windows the address and Windows will return the information having looked it up in its 'address book'. All of the create region APIs return a handle to a region. You can then use this handle to combine it with others, and then finally set the window's region to the new shape. These region creation APIs will return 0 on failure.

Once you have finished with a region or combined it into a new region, you must tell windows to remove the item from its address book, in order to free up resources. This is done using the DeleteObject API.

In this short tutorial, I will show you how to create rectangular, elliptical, round and other shaped regions, that you can combine together to create interesting effects such as the happy face window featured in the figure seen above.

Page 1 of 4

This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date