虽不太难 还是写来以后会方便不少
IDC_S是一个 图像 控件 用于指明分割窗口的位置
void CZzDlg::OnOK() 
...{
CString str;
GetDlgItemText(IDOK,str);
if(str=="收")
...{
SetDlgItemText(IDOK,"放");
}else
...{
SetDlgItemText(IDOK,"收");
}
static CRect rectLarge;
static CRect rectSmall;
if(rectLarge.IsRectNull())
...{
GetWindowRect(&rectLarge);
CRect rectSeparator;
GetDlgItem(IDC_S)->GetWindowRect(&rectSeparator);
rectSmall.left=rectLarge.left;
rectSmall.top=rectLarge.top;
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);
}
}
参考文献:VC++编程详解 作者:孙鑫
本文介绍了一个使用VC++实现的窗口切换功能,通过一个图像控件IDC_S来控制窗口大小的变化,并展示了如何通过按钮点击事件改变窗口的状态。
3301

被折叠的 条评论
为什么被折叠?



