我的对话框怎么不能完全收缩?
void CTestDlg::OnButton2()
{
// TODO: Add your control notification handler code here
CString str;
if(GetDlgItemText(IDC_BUTTON2,str),str=="收缩<<")
{
SetDlgItemText(IDC_BUTTON2,"扩展>>");
}
else
{
SetDlgItemText(IDC_BUTTON2,"收缩<<");
}
static CRect rectLarge;
static CRect rectSmall;
if(rectLarge.IsRectNull())
{
CRect rectSeparator;
GetWindowRect(&rectLarge);
GetDlgItem(IDC_SEPARATOR)->GetWindowRect(&rectSeparator);
rectSmall.left = rectLarge.left;
rectSmall.top = rectLarge.left;
rectSmall.right = rectLarge.right;
rectSmall.bottom = rectSeparator.bottom;
}
if(str=="收缩<<")
{
SetWindowPos(NULL,0,0,rectSmall.Width(),rectSmall.Height(),
SWP_NOMOVE | SWP_NOZORDER);
}
else
{
SetWindowPos(NULL,0,0,rectLarge.Width(),rectLarge.Height(),
SWP_NOMOVE | SWP_NOZORDER);
}
}
运行后对话框不能完全展开,不知道是不是我分割的时候出问题了。把分割线的位置设置的低一些它就缩的多一些。
分割线的长短不一样,收缩的程度也不一样,反正都不能缩到割线处。我用的是VC6.0,win7系统。
还有如果割线太长,程序结果有时候不正确,比如点收缩按钮的时候对话框应该是展开状态才对,可是有时候却恰恰相反。
最郁闷的是为啥不能缩到割线处?在分割的时候有什么讲究吗?