zoukankan      html  css  js  c++  java
  • 在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.");

  • 相关阅读:
    java练习6
    java练习5
    java练习4
    java练习3
    java练习2
    java练习1
    用代码实现判断字符串的开头和结尾
    语句练习题2
    语句练习题1
    值类型和引用类型的区别
  • 原文地址:https://www.cnblogs.com/ant-wjf/p/3214639.html
Copyright © 2011-2022 走看看