全部博文(61)
分类: WINDOWS
2008-10-09 01:26:20
1 增加一个分割符
采用图像控件
2 确定收缩后对话框的Rect的那些要素要发生变化
3 保存原来的对话框的大小 为了恢复
4 确定收缩后的对话框的大小
一下是源代码
void CDialogDlg::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.bottom = rectSeparator.bottom;
rectSmall.top = rectLarge.top;
rectSmall.right = rectLarge.right;
}
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);
}
}