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

📄 tpstatic.cpp

📁 任意点阵字模生成软件源代码
💻 CPP
字号:
// TpStatic.cpp : implementation file
//

#include "stdafx.h"
#include "showpic.h"
#include "TpStatic.h"

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

/////////////////////////////////////////////////////////////////////////////
// CTpStatic
COLORREF CStaticLink::g_colorUnvisited  = RGB(0,0,255);		 // blue
COLORREF CStaticLink::g_colorVisited    = RGB(128,0,128);	 // purple
COLORREF CStaticLink::g_colorOver		= RGB(255,0,0);	     // Red

CTpStatic::CTpStatic()
{
	m_link = lpText;								// link text (NULL ==> window text)
	m_color = g_colorUnvisited;				// not visited yet
//	m_bDeleteOnDestroy = bDeleteOnDestroy;	// delete object with window?
  //  m_bOverControl     = FALSE;                // Cursor not yet over control
    m_nTimerID         = 1;	m_brHollow.CreateSolidBrush(RGB(255,255,255));
}

CTpStatic::~CTpStatic()
{
}


BEGIN_MESSAGE_MAP(CTpStatic, CStatic)
	//{{AFX_MSG_MAP(CTpStatic)
	ON_WM_CTLCOLOR_REFLECT()
	ON_WM_MOUSEMOVE()
	ON_WM_ERASEBKGND()
	ON_WM_CTLCOLOR()
	ON_WM_LBUTTONDBLCLK()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTpStatic message handlers

HBRUSH CTpStatic::CtlColor(CDC* pDC, UINT nCtlColor) 
{
	ASSERT(nCtlColor == CTLCOLOR_STATIC);
	DWORD dwStyle = GetStyle();
	
	HBRUSH hbr = NULL;
	if ((dwStyle & 0xFF) <= SS_RIGHT) {
		// this is a text control: set up font and colors
		if (!(HFONT)m_font) {
			// first time init: create font
			LOGFONT lf;
			GetFont()->GetObject(sizeof(lf), &lf);
//			lf.lfUnderline = TRUE;
			m_font.CreateFontIndirect(&lf);
		}

		// use underline font and visited/unvisited colors
		pDC->SelectObject(&m_font);
		pDC->SetTextColor(m_color);
		pDC->SetBkMode(TRANSPARENT);

		// return hollow brush to preserve parent background color
		hbr = (HBRUSH)::GetStockObject(HOLLOW_BRUSH);

	}
	return hbr;
}

void CTpStatic::OnMouseMove(UINT nFlags, CPoint point) 
{
AfxMessageBox("ok");	
	CStatic::OnMouseMove(nFlags, point);
}

BOOL CTpStatic::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	pDC->SetBkMode(TRANSPARENT);
//return 0;
	return CStatic::OnEraseBkgnd(pDC);
}

HBRUSH CTpStatic::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CStatic::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	
	// TODO: Return a different brush if the default is not desired
	return hbr;
}



void CTpStatic::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	
	CStatic::OnLButtonDblClk(nFlags, point);
}



//DEL void CTpStatic::OnPaint() 
//DEL {
//DEL 	CPaintDC dc(this); // device context for painting
//DEL 	
//DEL 	// TODO: Add your message handler code here
//DEL //	dc.SetBkMode(TRANSPARENT);
//DEL //	dc.TextOut(0,0,Caption);
//DEL 	// Do not call CStatic::OnPaint() for painting messages
//DEL }

CString CTpStatic::GetCaption()
{
	return Caption;
}

void CTpStatic::SetCaption(CString sCaption)
{
	Caption=sCaption;
}

void CTpStatic::SetMyFont(CFont m_font)
{
}

⌨️ 快捷键说明

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