CRect的有关问题
CRect的问题
我在调试时程序在执行完自定义函数rectdef后,回到OnButton2()时,值又被回到了初始值
rectLarge,rectSmall均为成员变量
顺便问一下CRect需要赋初值么?
void CTestDlg::OnButton2()
{
// TODO: Add your control notification handler code here
if(rectLarge.IsRectEmpty ())
{
rectdef(rectLarge,rectSmall);
}
CString buf;
//////////////////////
void CTestDlg::rectdef(CRect rectLarge, CRect rectSmall)
{
GetWindowRect(&rectLarge);
GetDlgItem(IDC_SEPARATOR)->GetWindowRect(&rectSmall);
rectSmall.top=rectLarge.top;
rectSmall.left=rectLarge.left;
rectSmall.right =rectLarge.right;
}
------解决方案--------------------
你的意思是形参做返回值的作用么。。那你得定义引用的啊~~
我在调试时程序在执行完自定义函数rectdef后,回到OnButton2()时,值又被回到了初始值
rectLarge,rectSmall均为成员变量
顺便问一下CRect需要赋初值么?
void CTestDlg::OnButton2()
{
// TODO: Add your control notification handler code here
if(rectLarge.IsRectEmpty ())
{
rectdef(rectLarge,rectSmall);
}
CString buf;
//////////////////////
void CTestDlg::rectdef(CRect rectLarge, CRect rectSmall)
{
GetWindowRect(&rectLarge);
GetDlgItem(IDC_SEPARATOR)->GetWindowRect(&rectSmall);
rectSmall.top=rectLarge.top;
rectSmall.left=rectLarge.left;
rectSmall.right =rectLarge.right;
}
mfc
------解决方案--------------------
你的意思是形参做返回值的作用么。。那你得定义引用的啊~~