Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to draw a sizing grip in a dialog

297 views
Skip to first unread message

Dale M. Nurden

unread,
Feb 29, 2000, 3:00:00 AM2/29/00
to
What is the best way to draw a sizing grip into the lower right-hand
corner of a dialog box? I have a dialog box that is resizable, and it
would be nice to indicate this to the user by using a sizing grip. I
could just handle WM_PAINT and paint a bitmap there, but that isn't
very customization-friendly if the user has an unusual colour scheme
or if he has one of those "skin" programs that alters the appearance
of the general UI. I would prefer to use the "correct" way to do this,
if one exists. I can't use a status bar control, because it would be
out of place on a dialog box.

-Dale
--
Dale M. Nurden __|__ http://users.iafrica.com/d/da/dalen
dalen-rcis.co.za | Highway Radio, 101.5FM
dalen-iafrica.com | Christian Community Radio
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Author of TClockEx, the FREE taskbar clock enhancer.
Spam proofing in effect: Please use '@' in place of '-'.

AAA

unread,
Feb 29, 2000, 3:00:00 AM2/29/00
to
In general dialog boxes aren't meant to be resized in the first place. So if
you're going in that direction of the anti-standard look, a flat statusbar
would only display the sizing grip picture.


Peter Forbes

unread,
Feb 29, 2000, 3:00:00 AM2/29/00
to

Dale,

Use a scrollbar control with the SBS_SIZEGRIP style. This
has the added feature of resizing the parent window (dialog
box, in your case) when clicked. This is the mechanism that
the resizable dialog boxes in Windows 98 (like the file
chooser) use. You will probably want to look at the docs
for more specific info about how to use it, but that's the
best accepted way to do it.

As a co-author of an interface customization program like
you mention, I'm very happy to see that's a consideration
for you. I wish more people were as careful.


Peter

Chris Trueman

unread,
Feb 29, 2000, 3:00:00 AM2/29/00
to
Check out www.codeguru.com, the examples there use MFC but you should be
able to figure out they work and apply to your environment.


Chris.

Dale M. Nurden <da...@not.my.real.email.address> wrote in message
news:38bc025d....@dbn-news.iafrica.com...

Scott Robins

unread,
Feb 29, 2000, 3:00:00 AM2/29/00
to
da...@not.my.real.email.address (Dale M. Nurden) wrote in
<38bc025d....@dbn-news.iafrica.com>:

>What is the best way to draw a sizing grip into the lower right-hand
>corner of a dialog box?

[snip]

DrawFrameControl()?

ScottR
--
Scott Robins, Xerox Engineering Systems
Scott....@USA.Xerox.com, http://www.xes.com

Dale M. Nurden

unread,
Mar 1, 2000, 3:00:00 AM3/1/00
to
On Tue, 29 Feb 2000 23:13:52 GMT, Peter Forbes <pe...@thematic.com>
wrote:

>Use a scrollbar control with the SBS_SIZEGRIP style. This
>has the added feature of resizing the parent window (dialog
>box, in your case) when clicked. This is the mechanism that
>the resizable dialog boxes in Windows 98 (like the file
>chooser) use. You will probably want to look at the docs
>for more specific info about how to use it, but that's the
>best accepted way to do it.

Thanks, I will give that a try.

>As a co-author of an interface customization program like
>you mention, I'm very happy to see that's a consideration
>for you. I wish more people were as careful.

Doesn't everyone? ;-)

-Dale

Do it properly or don't do it at all.

ge7...@my-deja.com

unread,
Mar 1, 2000, 3:00:00 AM3/1/00
to
In article <38bc025d....@dbn-news.iafrica.com>,

da...@not.my.real.email.address (Dale M. Nurden) wrote:
> What is the best way to draw a sizing grip into the lower right-hand
> corner of a dialog box?

Try adding the following to your dialog class:

// Message handler for WM_NCHITTEST
UINT CMyDialog::OnNcHitTest(CPoint point)
{
CRect rect;
GetSizeGripRect(&rect);
// The point to be tested is in screen coordinates
ClientToScreen(&rect);
// When in the size grip, pretend to be a portion of the sizing border
if (rect.PtInRect(point))
return HTBOTTOMRIGHT;
// Not in gripper portion -- pass along to parent class
return CDialog::OnNcHitTest(point);
}

// Message handler for WM_PAINT
void CMyDialog::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rect; // rectangle for drawing the size grip
GetSizeGripRect(&rect);
dc.DrawFrameControl(rect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
// Do not call CDialog::OnPaint() for painting messages
}

void CMyDialog::GetSizeGripRect(LPRECT lpRect)
{
GetClientRect(lpRect);
lpRect->left = lpRect->right - ::GetSystemMetrics(SM_CXHSCROLL);
lpRect->top = lpRect->bottom - ::GetSystemMetrics(SM_CYVSCROLL);
}

Hope this helps.


Sent via Deja.com http://www.deja.com/
Before you buy.

ge7...@my-deja.com

unread,
Mar 1, 2000, 3:00:00 AM3/1/00
to
0 new messages