Creating a Round Dialog

Environment: The code in this article was developed using Visual C++ 4.0

This code is used to make a round dialog for various Apps.
This could be good for use with an MP3 or CDPLAYER or any other.

Surprisingly it’s not that hard!

[I looked but nobody had written anything for a round dialog. I had
been trying to shape a dialog for some time. Then after playing
with the Microsoft CD for a SetWindowRgn() for a window I tried to
use it for a dialog. Viola! After Jumping around a few times after
it compiled I sent it to the Code Guru.

[CRgn m_rgn; // This is for the dialog area: It goes in your h. file

// This Gets the size of the Dialog: This goes under the OnInitDialog Function
Crect rcDialog
GetClientRect(rcDialog);

// This Creates area assigned to Dialog: This goes directly below the above in OnInitDialog
m_rgn.CreateEllipticRgn(0, 0, rcDialog.Width(), rcDialogHeight());
SetWindowRgn(GetSafeHwnd(), (HRGN) m_rgn, TRUE);]

Download demo project – 17 KB

Download source – 3 KB

Date Last Updated: April 18, 1999

More by Author

Must Read