主题

1.
创建状态栏 并显示

2.
在状态栏中显示进度条

3.
MDI文档显示和隐藏状态栏

4.

5.

 
 

代码::创建状态栏
并显示

//手动添加3个ICON

/////////////////////////////////////////////////////////////////////////////
// CProject01Dlg dialog
//
// class CProject01Dlg : public
CDialog
// {
// // Construction
// public:
// CProject01Dlg(CWnd* pParent = NULL);
// standard constructor
    CStatusBar m_statusBar;
 
 
// BOOL CProject01Dlg::OnInitDialog()

// TODO: Add extra initialization
here     
BOOL bRec = m_statusBar.Create( this );
UINT nIDS[ 3 ] =
{0x1001,0x1002,0x1003};
bRec = m_statusBar.SetIndicators(nIDS, 9 );
m_statusBar.SetPaneInfo( 0 ,nIDS[ 0 ],SBPS_NORMAL, 100 );
m_statusBar.SetPaneInfo( 1 ,nIDS[ 1 ],SBPS_NORMAL, 200 );
m_statusBar.SetPaneInfo( 2 ,nIDS[ 2 ],SBPS_NORMAL, 32565 );
m_statusBar.SetPaneText( 0 , "提示:" );
RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST, 0 );
 
 
//添加OnSize消息
void CProject01Dlg::OnSize(UINT nType, int cx, int cy)
{
    CDialog::OnSize(nType, cx, cy);
    
    // TODO: Add your message handler code
here
    RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST, 0 );
}
 
//即时显示鼠标所放在菜单的的文字
//在类向导中添加 1 个WindowProc消息
LRESULT
CProject01Dlg::WindowProc(UINT message,
WPARAM wParam, LPARAM lParam)
{
    // TODO: Add your specialized code here and/or call
the base class
    if (message == WM_MENUSELECT)
{
        // OnHotMenu(LOWORD(wParam));
        CMenu
* pMenu = GetMenu();
        if
(pMenu != NULL)
        {
            CString
strText;
            pMenu
- > GetMenuString(( int )LOWORD(wParam),strText,MF_BYCOMMAND);
            m_statusBar.SetPaneText( 1 ,strText);
        }
        
}
    return CDialog::WindowProc(message, wParam, lParam);

}

 

效果图:

 
 
 
    

Code::
MDI文档显示和隐藏状态栏

//Show
void CMainFrame::OnShow() 
{
    if(!m_wndStatusBar.IsWindowVisible())
    {
        m_wndStatusBar.ModifyStyle(0, WS_VISIBLE,SWP_FRAMECHANGED);
    }
    //使状态栏状态生效
    SendMessage(WM_SIZE);
}
    
//Hide
void CMainFrame::OnHide() 
{
    if(m_wndStatusBar.IsWindowVisible())
    {
        m_wndStatusBar.ModifyStyle(WS_VISIBLE, 0,SWP_FRAMECHANGED);
    }
    //使状态栏状态生效
    SendMessage(WM_SIZE);
}

效果图:

 
 

C++ Code_StatusBar的更多相关文章

随机推荐

  1. org.unsaved transient instance - save the transient instance before flushing: bug解决方案

    最近开发和学习过程中,遇到很多零碎的知识点,在此简单地记录下: 1.遇如下bug: org.unsaved transient instance - save the transient instan ...

  2. 任务(Tasks)

    在Eclipse中用TODO标签管理任务,利用这个功能可以方便地将项目中一些需要处理的任务记录下来.我们可以通过在java注释里添加任务标签来标记一个任务,任务可以通过Tasks(任务)视图来察看. ...

  3. EIGRP汇总

    转自:http://myhat.blog.51cto.com/391263/193189/ 实验目的:1.理解EIGRP的自动汇总的缺点2.配置EIGRP手工汇总的方法A>>>还是老 ...

  4. 黑马程序员——Objective-c特性

    1. 继承  Objective-c不支持多继承. Super 关键字:调用该类的父类: 超类:父类的另一种说法. 2.自定义NSLog()输出: 在类中添加description方法就可以自定义NS ...

  5. [Lua]入门教程

    什么是Lua Lua 是一个小巧的脚本语言.是巴西里约热内卢天主教大学(Pontifical Catholic University of Rio de Janeiro)里的一个研究小组,由Rober ...

  6. [转] Web前端优化之 图片篇

    原文链接: http://lunax.info/archives/3101.html Web 前端优化最佳实践第六部分面向 图片(Image),这部分目前有 4 条规则.在最近的 Velocity 2 ...

  7. Git 提交后开始自动构建

    设定Git仓库的钩子 一般路径为 xxx.git/hooks 参考文档 https://git-scm.com/docs/githooks 修改 post-receive #!/bin/bash wh ...

  8. 重复安装Lync导致发布拓扑失败

    重复安装Lync会引起发布拓扑错误,主要原因就是Lync在域控服务器写了东西. 在出错日志中看到guid,查资料说到域控的CN=Trusted Services,CN=RTC Service,CN=S ...

  9. iOS 中UIButton的 settitle 和 titlelabel的使用误区

    UIButton中设置Titl方法包括以下几种: - (void)setTitle:(NSString *)title forState:(UIControlState)state; - (void) ...

  10. POJ2947Widget Factory(高斯消元解同模方程)

    http://poj.org/problem?id=2947 题目大意:有n 种装饰物,m 个已知条件,每个已知条件的描述如下:p start enda1,a2......ap (1<=ai&l ...