⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statusbarxp.cpp

📁 用过恒迅达交换机的人都知道。恒迅达交换机是需要在交换机内部运行中间程序来给脚本提供数据接口并且监控机器运行状态的。本程序即是完成以上功能!用C++开发、调用了数据库(sqlserver2000)存储过
💻 CPP
字号:
///////////////////////////////////////////////////////////////////////////////
//
// StatusBarXP.cpp : implementation file
//
///////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "StatusBarXP.h"
//#include "Draw.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

///////////////////////////////////////////////////////////////////////////////
BOOL CStatusBarXP::SetIndicators (const UINT* lpIDArray, int nIDCount)
{
    if ( !CStatusBar::SetIndicators (lpIDArray, nIDCount) )
    {
        return false;
    }
    SendMessage (SB_SETMINHEIGHT, 20);

    for ( int i = 0; i < nIDCount; i++ )
    {
        UINT a, b;
        int c;

        GetPaneInfo (i, a, b, c);
        SetPaneInfo (i, a, b|SBPS_NOBORDERS, c);
    }
    return true;
}

///////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CStatusBarXP, CStatusBar)
    //{{AFX_MSG_MAP(CStatusBarXP)
    ON_WM_PAINT()
    //}}AFX_MSG_MAP
END_MESSAGE_MAP()

IMPLEMENT_DYNAMIC(CStatusBarXP, CStatusBar);

///////////////////////////////////////////////////////////////////////////////
void CStatusBarXP::OnPaint ()
{
    Default();

    CClientDC cDC (this);
    //CPenDC pen (cDC, ::GetSysColor (COLOR_3DSHADOW));
    CRect rcItem;
	
    cDC.SelectObject (::GetStockObject (NULL_BRUSH));

    for ( int i = 0; i < m_nCount; i++ )
    {
        GetItemRect (i, rcItem);
        cDC.Rectangle (rcItem); 
    }
}

void CStatusBarXP::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	// Attach to a CDC object
	CDC dc;
	dc.Attach(lpDrawItemStruct->hDC);

	dc.SetBkMode(TRANSPARENT);
	
	// Get the pane rectangle and calculate text coordinates
	CRect rect(&lpDrawItemStruct->rcItem);
	CString str;
	switch(lpDrawItemStruct->itemID) {

		case 1:
			str=GetPaneText(1);
			//if(str.Find("正常")>0)
			dc.SetTextColor(RGB(0, 0, 128));
			//else dc.SetTextColor(RGB(255, 0, 0));
			dc.TextOut(rect.left+1, rect.top+1, str);
			break;

	}

	dc.Detach();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -