المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : OnSize [modified]



C++ Programming
08-26-2009, 09:45 AM
A question is such:overload a function OnSize(). I want, that buttons at the stretch of basic window either upwards or to the right saved the positions in relations to the overhead and right edges of main ********

Code:
void CMobileTISDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
if(Flag)
{
CRect R = CRect(0,0,0,0);
GetWindowRect(&R);
ScreenToClient(&R);
LONG right = R.right - MinSize.right;// ?Rect MinSize is filled in OnInitDialog and contains main window extents at the start of the program
LONG top = MinSize.top - R.top;
int nCount = ResData.size();
for(int i=0;iMoveWindow(ResData[i].aRect.left+right,
ResData[i].aRect.top-top,
ResData[i].aRect.Width(),
ResData[i].aRect.Height());
}
}
}

ResData is a vector, containing structures
???:


struct ResizeStruct
{
CRect aRect;//Rect of button
UINT nID;//ID of button
};

Filling of structure:

void CMobileTISDlg::SetResData(UINT nID)
{
ResizeStruct Res;
Res.aRect = CRect(0,0,0,0);
GetDlgItem(nID)->GetClientRect(&Res.aRect);
Res.nID = nID;
ResData.push_back(Res);
}

A problem is such: at testing of the program the buttons appear in one place in the left corner of the program. What is my error in?

modified on Wednesday, August 26, 2009 1:28 AM