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

📄 outputbar.cpp

📁 利用CJ60库创建界面
💻 CPP
字号:
// OutputBar.cpp: implementation of the COutputBar class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "DutComputerManager.h"
#include "OutputBar.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

COutputBar::COutputBar()
{
	UpdateFont();
}

COutputBar::~COutputBar()
{
	// TODO: add destruction code here.
}

IMPLEMENT_DYNAMIC(COutputBar, CCJControlBar)

BEGIN_MESSAGE_MAP(COutputBar, CCJControlBar)
	//{{AFX_MSG_MAP(COutputBar)
	ON_WM_CREATE()
	ON_WM_SIZE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

static CString strBuild[] =
{
	_T("--------系统安全登陆---------------------"),
	_T("等待操作..."),
};

static CString strDebug[] =
{
	_T("不要着急,还没有写完呢"),

};

/////////////////////////////////////////////////////////////////////////////
// COutputBar message handlers

int COutputBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CCJControlBar::OnCreate(lpCreateStruct) == -1)
		return -1;

	// create  the flat tab control.
	if (!m_FlatTabCtrl.Create(WS_VISIBLE | WS_CHILD | FTCS_DEFAULT | FTCS_HSCROLL,
			CRect(10,10,200,25), this, IDC_FLATTAB))
	{
		TRACE0( "Unable to create flat tab control bar\n" );
		return -1;
	}

	m_FlatTabCtrl.ModifyStyleEx(0, WS_EX_CLIENTEDGE );

	// define the default style for the output lists.
	DWORD dwStyle = WS_CHILD | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP;

	// create the build list.
	if (!m_BuildList.Create( dwStyle, CRect(0,0,0,0), this, ID_BUILDLIST ))
	{
		TRACE( _T("Failed to create output window.\n" ));
		return -1;
	}
	m_BuildList.SetFont( &m_Font );
	m_BuildList.SetshowHScroll();

	// create the debug list.
	if (!m_DebugList.Create( dwStyle, CRect(0,0,0,0), this, ID_DEBUGLIST ))
	{
		TRACE( _T("Failed to create output window.\n") );
		return -1;
	}
	m_DebugList.SetFont( &m_Font );
	

	// insert the actual tabs into the control.
	m_FlatTabCtrl.InsertItem(0, IDS_BUILD, &m_BuildList);
	m_FlatTabCtrl.InsertItem(1, IDS_DEBUG, &m_DebugList);

	// fill the debug list with some data.
	int nBuildCount = sizeof(strBuild)/sizeof(strBuild[0]);
	for( int i = 0; i < nBuildCount; ++i) 
	{
		m_BuildList.AddString(strBuild[i]);
	}

	// fill the debug list with some data.
	int nDebugCount = sizeof(strDebug)/sizeof(strDebug[0]);
	for( i = 0; i < nDebugCount; ++i) 
	{
		m_DebugList.AddString(strDebug[i]);
	}

	// set the current tab.
	m_FlatTabCtrl.SetCurSel(0);
	return 0;
}

BOOL COutputBar::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
{
	if(IDC_FLATTAB == (UINT)wParam)
	{
		NMHDR* pNMHDR = (NMHDR*)lParam;

		switch(pNMHDR->code)
		{
		case TCN_SELCHANGING:
			break;
		case TCN_SELCHANGE:
			break;
		}
	}
	
	return CCJControlBar::OnNotify(wParam, lParam, pResult);
}

void COutputBar::OnSize(UINT nType, int cx, int cy) 
{
	CCJControlBar::OnSize(nType, cx, cy);
	
	if(m_FlatTabCtrl.GetSafeHwnd())
	{
		CRect rc;
		GetClientRect(rc);
		m_FlatTabCtrl.MoveWindow(rc);
	}
}

void COutputBar::UpdateFont()
{
	m_Font.DeleteObject();
	NONCLIENTMETRICS ncm;
	memset(&ncm, 0, sizeof(NONCLIENTMETRICS));
	ncm.cbSize = sizeof(NONCLIENTMETRICS);
	VERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
		sizeof(NONCLIENTMETRICS), &ncm, 0));
	_tcscpy( ncm.lfMessageFont.lfFaceName, _T("Courier"));
	m_Font.CreateFontIndirect(&ncm.lfMessageFont);
}


void COutputBar::AddStringtoList(CString strmsg)
{
	m_BuildList.AddString(strmsg);
	m_BuildList.SetTopIndex( m_BuildList.GetCount()-1);
}

void COutputBar::ClearListInfo()
{
	m_BuildList.ResetContent();
}

⌨️ 快捷键说明

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