I have seen code which handles the drawing of this thing (DFCS_SCROLLSIZEGRIP
), but surely there is a window style which I can apply to get it "for free". Right?
views:
352answers:
2
+1
A:
In lieu of a better answer, I will post the code I have that draws the size grip and handles the hit-testing. You also need to invalidate the appropriate area during OnSize in order to get it repainted.
BOOL CMyDialog::OnEraseBkgnd(CDC* pDC)
{
if (CDialog::OnEraseBkgnd(pDC))
{
// draw size grip
CRect r;
GetClientRect(&r);
int size = GetSystemMetrics(SM_CXVSCROLL);
r.left = r.right - size;
r.top = r.bottom - size;
pDC->DrawFrameControl(&r, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
return TRUE;
}
else
{
return FALSE;
}
}
-
LRESULT CMyDialog::OnNcHitTest(CPoint point)
{
// return HTBOTTOMRIGHT for sizegrip area
CRect r;
GetClientRect(&r);
int size = GetSystemMetrics(SM_CXVSCROLL);
r.left = r.right - size;
r.top = r.bottom - size;
ScreenToClient(&point);
if (r.PtInRect(point))
{
return HTBOTTOMRIGHT;
}
else
return CDialog::OnNcHitTest(point);
}
Nick
2009-03-04 19:08:54
A:
I don't think there is a default style to get this functionality for free. You have to create a new child window with class name Scrollbar
and control style SBS_SIZEGRIP
Raul Agrait
2009-03-30 15:55:13