Chinaunix首页 | 论坛 | 博客
  • 博客访问: 408783
  • 博文数量: 61
  • 博客积分: 2138
  • 博客等级: 大尉
  • 技术积分: 882
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-07 11:58
文章分类

全部博文(61)

文章存档

2012年(1)

2011年(8)

2010年(12)

2009年(6)

2008年(34)

我的朋友

分类: WINDOWS

2008-10-09 01:26:20

                      CDlg 窗口的分割 收缩和扩张
 

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);

       }

}

阅读(1692) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~