Non-rectangular Windows

Status
Not open for further replies.

spagthorpe

Ars Tribunus Angusticlavius
7,304
I've seen this a few times, and actually think it would be cool for one of my current projects. I want to display a non-rectangular device on the screen, so the bitmap of the device is the only visible part of the app. No title bar, no menus, no border.

How is this done? Are they using a rectangular window and just blitting the stuff behind it to the window background, or is there a way to mask the window so that it doesn't paint anything but the bitmap?

I have a routine for drawing transparent bitmaps to windows, but I guess the problem I'm having is not drawing any window at all. Obviously, I would want mouse clicks to register inside the window, but change focus if clicked off the bitmap. Any ideas?
 

Defcon

Ars Tribunus Militum
2,039
Non rectangular windows are created by defining a specific shape for the Window. In Windows' terminology, you create a specific Region for your window. Regions can have any shape you like. USe SetWindowRgn to set the window's visible region.

Here's a sample from MSDN which does it using MFC - all its doing is handling WM_SIZE and pass a HRGN.

From MSDN
 
Status
Not open for further replies.