zoukankan      html  css  js  c++  java
  • 可伸缩的窗口

    ##

    伸缩窗口的代码:

    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);
  • 相关阅读:
    第24课 多线程开发
    第23课 装饰器
    第22课 调用外部程序
    第20课 异常处理
    第19课 习题讲解
    第18课 面向对象
    第17课 调试程序
    第16课 pycharm 使用
    第15课 模块与包
    第14课 再识函数
  • 原文地址:https://www.cnblogs.com/tinaluo/p/7413825.html
Copyright © 2011-2022 走看看