码迷,mamicode.com
首页 > 其他好文 > 详细

可伸缩的窗口

时间:2017-08-22 23:14:24      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:sep   idc   move   null   代码   pos   swp   code   order   

##

伸缩窗口的代码:

void CVbvbDlg::OnButton1() //伸缩窗口
{
    
    CString str;
    if(GetDlgItemText(IDC_BUTTON1,str),str=="收缩<<")
    {

        SetDlgItemText(IDC_BUTTON1,"扩展>>");
        SetWindowPos(NULL,0,0,rectSmall.Width(),rectSmall.Height(),SWP_NOMOVE | SWP_NOZORDER);
        //SetWindowPos()函数用于改变窗口的配置;
    }
    else
    {
        SetDlgItemText(IDC_BUTTON1,"收缩<<");
        SetWindowPos(NULL,0,0,rectLarge.Width(),rectLarge.Height(),SWP_NOMOVE | SWP_NOZORDER);
    }
}

初始化时获取伸缩窗口的尺寸:

    CRect rectSeparator;
    GetWindowRect((&rectLarge));

    GetDlgItem(IDC_RIGHT)->GetWindowRect((&rectSeparator));
    
    rectSmall.left=rectLarge.left;
    rectSmall.top=rectLarge.top;
    rectSmall.bottom=rectLarge.bottom;
    rectSmall.right=rectSeparator.left;

    SetWindowPos(NULL,0,0,rectSmall.Width(),rectSmall.Height(),SWP_NOMOVE | SWP_NOZORDER);

 

可伸缩的窗口

标签:sep   idc   move   null   代码   pos   swp   code   order   

原文地址:http://www.cnblogs.com/tinaluo/p/7413825.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!