• 在Dialog中添加状态栏


    参考:http://www.cppblog.com/besterChen/archive/2009/04/03/78846.aspx

     

    1. 创建字符资源:ID_INDICATOR_1、ID_INDICATOR_2
    2. CMyDialog.h中,添加类成员变量 CStatusBar m_wndStatusBar;
    3. CMyDialog.cpp中,添加全局变量:
    static UINT indicators[] =
    {
         ID_SEPARATOR, // status line indicator
     
         ID_INDICATOR_1,
         ID_INDICATOR_2
    };

          初始化函数中,添加:

    CRect rect;
    this->GetClientRect(rect);
    if(!m_wndStatusBar.Create(this)|| !m_wndStatusBar.SetIndicators(indicators,sizeof(indicators)/sizeof(UINT)))
    {
        TRACE0("Can't create status bar ");
        return FALSE;
    }
    m_wndStatusBar.MoveWindow(0, rect.bottom-20, rect.right, 20); // 调整状态栏的位置和大小 

        在状态栏中显示信息

    int nIndex = m_wndStatusBar.CommandToIndex(nID);
    //m_wndStatusBar.SetPaneInfo(nIndex, nID, SBPS_NORMAL, 50); // 调整显示栏宽度
    m_wndStatusBar.SetPaneText(nIndex, wszText);

     

    也可以这样显示:

    SetMessageText(L"status bar msg."); // Call this function to place a string in the status-bar pane that has an ID of 0.

    GetMessageBar()->SetWindowText(L"status bar msg.");

  • 相关阅读:
    48日报
    410日报
    411日报
    412日报
    46
    python列表映射元素替换
    Stein's 无偏风险估计(Stein's unbiased risk estimate)
    powershell 改默认编码
    小程序 时分秒
    less用法
  • 原文地址:https://www.cnblogs.com/ant-wjf/p/3214639.html
Copyright © 2020-2023  润新知