Creating a Round Dialog
Posted
by Anthony D. Davis
on April 18th, 1999
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);]
Date Last Updated: April 18, 1999

Comments
Very Very Good; Life Saver
Posted by Legacy on 02/03/2003 12:00amOriginally posted by: Bradford Powers
This was exactly what i was looking for. Thank You!!!!!!
P.S Minus a few typos, but i can understand the excitment :)
Brad
ReplySk8kloud Software
Hey
Posted by Legacy on 08/27/2002 12:00amOriginally posted by: ravi
It works ...looks really great ...
ReplyGood - but I have a question about the CAPTION.
Posted by Legacy on 04/12/2000 12:00amOriginally posted by: Charlie Roche
I've been making non rectangular dialogs lately, and there are a few different ways to do this. Yours is a good one, but I'm still confused as to how to create a DIALOG with it's icon and title in the task bar but setting it such that the dialog doesnt draw itself a caption. You can do it with a CWnd, by using the CreateEx(...) function, and setting the title string in one of it's parameters, but I havent got this working for a dialog. Can anyone shed some light on this for me?
Thanks in advance,
Charlie
ReplyHow to avoid blink on the dialog
Posted by Legacy on 11/29/1999 12:00amOriginally posted by: VICTOR CARRE�O
When I use a dialog box, in the OnPaint function i draw different color rectangles.
How can i do, to avoid blink the screen when i move another window on my dialog.
I save CRect objects in a CObArray.
Thanks You.
Replyredraw problem...
Posted by Legacy on 11/16/1999 12:00amOriginally posted by: scott
When the round dialog is moved, there is a slight redraw problem. There is a slight lag in the redraw. Is there any way to have this lag taken out?
Scott.
Replysb@nh.ca
Border?
Posted by Legacy on 10/26/1999 12:00amOriginally posted by: Johannes Str�mberg
Great tip, however it
could use a border, does anyone know how to make one?
/Johannes
ReplyROUNDED DIALOG
Posted by Legacy on 09/26/1999 12:00amOriginally posted by: sudi
Hi there, great work
Replyhelped me..
cheers
sudarshan
Any Shape Dialog Box
Posted by Legacy on 05/23/1999 12:00amOriginally posted by: Jon Woolman
If you use CreatePolygonRgn() as in the previous examples, you can create dialog boxes of any shape. It is also possible to use CreatePolyPolygonRgn() to create dialog boxes that are separated into several different shapes.
Replyslight changes
Posted by Legacy on 04/23/1999 12:00amOriginally posted by: Andrew Bryan
I was unable to get rid of the remains of the dialog frame using the resource editor, however, it you change the create for the region from 0,0 to 2,2 , the frame goes bye bye.
This make it all look a bit more tidy. By the way, is there another way to centre the caption without using spaces??
// This Creates area assigned to Dialog
m_rgn.CreateEllipticRgn(2, 2, rcDialog.Width(), rcDialog.Height());
::SetWindowRgn(GetSafeHwnd(), (HRGN)m_rgn, TRUE);
ReplyAndrew
kool
Posted by Legacy on 04/20/1999 12:00amOriginally posted by: KlangenFarben
Reply