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

📄 exdlgengine.cpp

📁 采用evc编程,可以打开掌上电脑的根目录
💻 CPP
字号:
// ExDlgEngine.cpp: implementation of the CExDlgEngine class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ExDlgEngine.h"

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

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

CExDlgEngine::CExDlgEngine()
{

}

CExDlgEngine::~CExDlgEngine()
{

}


// CExDlgEngine::PaintHeader
//
//		Paints a PocketPC 2002 dialog header
//
void CExDlgEngine::PaintHeader(CWnd* pWnd, CDC &dc, LPCTSTR pszTitle)
{
	CRect		recWnd;
	int			nWidth;// = dc.GetDeviceCaps(HORZRES);
	const int	nHeaderHeight = 24;

	pWnd->GetClientRect(&recWnd);
	nWidth = recWnd.right;

	// paint title
	CFont *pCurrentFont = dc.GetCurrentFont();
	LOGFONT lf;
	pCurrentFont->GetLogFont(&lf);
	lf.lfWeight = FW_BOLD;
	CFont newFont;
	newFont.CreateFontIndirect(&lf);

	CFont *pSave = dc.SelectObject(&newFont);
	dc.SetTextColor(RGB(0, 0, 156));
	dc.DrawText(pszTitle, -1, CRect(8, 0, nWidth, nHeaderHeight), DT_VCENTER | DT_SINGLELINE);
	dc.SelectObject(pSave);

	// paint line
	CPen blackPen(PS_SOLID, 1, RGB(0,0,0));
	CPen *pOldPen = dc.SelectObject(&blackPen);

	dc.MoveTo(0, nHeaderHeight);
	dc.LineTo(nWidth, nHeaderHeight);

	dc.SelectObject(pOldPen);	
}


// CExDlgEngine::Underline
//
//		Underlines the list of controls in the zero-terminated array
//
void CExDlgEngine::Underline(CWnd* pWnd, CDC &dc, UINT *pArrID)
{
	CPen		penLine(PS_SOLID, 1, RGB(192,192,192)),
		*		pPenOld;
	CWnd*		pCtl;
	CRect		rcDlg,
				rcCtl;
	UINT*		pID;

	//
	// Initialize the variables
	//
	pWnd->GetClientRect(&rcDlg);

	pPenOld = dc.SelectObject(&penLine);

	//
	// Loop through all edit boxes and draw a bottom line
	//
	for(pID = pArrID; *pID; pID++)
	{
		pCtl = pWnd->GetDlgItem(*pID);
		if(pCtl)
		{
			pCtl->GetWindowRect(&rcCtl);
			pWnd->ScreenToClient(&rcCtl);

			dc.MoveTo(rcCtl.left - 2, rcCtl.bottom);
			dc.LineTo(rcDlg.right - 2, rcCtl.bottom);
		}
	}

	dc.SelectObject(pPenOld);
}


// CExDlgEngine::CreateDateTime
//
//		Creates a date time control using an existing control as reference
//
BOOL CExDlgEngine::CreateDateTime(CWnd* pWnd, CDateTimeCtrl &dtc, UINT nID, DWORD dwStyle)
{
	CWnd*	pCtl;
	CFont*	pFont;
	CRect	rc;

	pCtl = pWnd->GetDlgItem(nID);
	if(pCtl)
	{
		pFont = pCtl->GetFont();
		pCtl->GetWindowRect(rc);
		pCtl->DestroyWindow();		//pWnd was just a placeholder;
		pWnd->ScreenToClient(rc);
		dtc.Create(WS_CHILD|WS_VISIBLE/*|WS_BORDER*/|dwStyle, 
			rc, pWnd, nID);
		dtc.SetFont(pFont);
	}

	return (pCtl != NULL);
}

⌨️ 快捷键说明

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