Re: How to keep a Dialog's width and height in a solid ratio



Thanks Seetharam.

But I only can do it by handling CDlg1::WindowProc(UINT message, WPARAM
wParam, LPARAM lParam) with message == WM_SIZING.

If I try CDlg1::OnSizing(UINT fwSide, LPRECT pRect), it doesn't go there at
all when I re-size the dialog. I just don't know what is wrong. I did as
follows,

class CDlg1 : public CDialog
{
protected:
//{{AFX_MSG(CDlg1)
virtual BOOL OnInitDialog();
afx_msg void OnSizing( UINT nSide, LPRECT lpRect );
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

void CDlg1::OnSizing(UINT fwSide, LPRECT pRect)
{
CDialog::OnSizing(fwSide, pRect);

pRect->bottom = pRect->top + (pRect->right - pRect->left) * 3 / 4;
}
If you set a breakpointer at the line of "pRect->bottom = pRect->top +
(pRect->right - pRect->left) * 3 / 4;"
it doesn't go in here.

William



void CDlg1::OnSizing(UINT fwSide, LPRECT pRect)
{
CDialog::OnSizing(fwSide, pRect);

// check for the fwSide you want.. assuming bottom right..
pRect->bottom = pRect->top + 0.75 * (pRect->right - pRect->left) ;
}

-Seetharam Misro


.



Relevant Pages