Re: size grip in dialog boxes



// WM_ERASEBKGND

BOOL CMyDlg::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;

}

}



// WM_NCHITTEST

UINT CMyDlg::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);

}



// WM_SIZING

void CMyDlg::OnSizing(UINT fwSide, LPRECT pRect)

{

CDialog::OnSizing(fwSide, pRect);



// invalidate an area currently (before resizing) occupied

// by size grip

CRect r;

GetClientRect( & r);

int size = GetSystemMetrics(SM_CXVSCROLL);

r.left = r.right - size;

r.top = r.bottom - size;

InvalidateRect( & r, FALSE); // do not erase background now



// invalidate an area which will be (after resizing)

// occupied by size grip

r = * pRect;

r.left = r.right - size;

r.top = r.bottom - size;

InvalidateRect( & r, FALSE);

}



"srinivas vaithianathan" <srinivasvaithianathan@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote in message news:DE74D7A1-8C86-4E0E-9B9A-29B90191A4FB@xxxxxxxxxxxxxxxx
>I would like to show a size grip in a dialog box. (a small bitmap at the
> right corner of dialog box to help in resizing). I think this is a
> standard
> feature of Windows XP visual styles. I created a dialog box with
> WS_THICKFRAME style and I have manifest file to get 6.0 common ctrls. But
> I
> do not see any size grip in the right corner even though the frame of the
> dialog box allows resizing.


.



Relevant Pages

  • Re: resizable dialog window
    ... Resizing border is enabled by WS_THICKFRAME style, ... dialog style to show size grip. ... // invalidate an area currently occupied ... I would like to create resizable dialog window, ...
    (microsoft.public.vc.mfc)
  • Re: how to resize child window?
    ... > when the parent resizes should be fine... ... >> and the resizing stops after just changing a bit. ... >> int hWndInsertAfter, ...
    (microsoft.public.win32.programmer.gdi)
  • Re: size grip in dialog boxes
    ... get the size grip! ... > // invalidate an area currently (before resizing) occupied ... >> feature of Windows XP visual styles. ...
    (microsoft.public.win32.programmer.ui)
  • Re: Directx and gdi alignment
    ... heres the code for resizing that I used: ... void CttextView::OnSize(UINT nType, int cx, int cy) ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: ClistCtrl > How to auto-adjust columns size ?
    ... You can use code below in OnSize() of ListCtrl. ... I've wrote new class which based on few types of resizing (on ... int wc1 = GetColumnWidth; ...
    (microsoft.public.vc.mfc)