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

📄 gfxincombostatic.cpp

📁 一个多线程的网络数据采集系统(客户端)
💻 CPP
字号:
// GfxInComboStatic.cpp : implementation file
//

#include "stdafx.h"
#include "WspProcess.h"


#include "GfxInComboStatic.h"
#include "GfxInCombo.h"

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

/////////////////////////////////////////////////////////////////////////////
// CGfxInComboStatic

CGfxInComboStatic::CGfxInComboStatic()
{
	pCombo = NULL;
	crColor = GetSysColor(COLOR_WINDOWTEXT);
}

CGfxInComboStatic::~CGfxInComboStatic()
{
}


BEGIN_MESSAGE_MAP(CGfxInComboStatic, CStatic)
	//{{AFX_MSG_MAP(CGfxInComboStatic)
	ON_WM_KILLFOCUS()
	ON_WM_ERASEBKGND()
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGfxInComboStatic message handlers

void CGfxInComboStatic::OnKillFocus(CWnd* pNewWnd) 
{
	CStatic::OnKillFocus(pNewWnd);
	if (pNewWnd != GetParent() && !(GetParent()->IsChild(pNewWnd))) 
		GetParent()->DestroyWindow();
}

BOOL CGfxInComboStatic::OnEraseBkgnd(CDC* pDC) 
{
	CRect rc;
	GetClientRect(rc);
	pDC->FillSolidRect(rc, GetSysColor(COLOR_WINDOW));
	return true;	
}

void CGfxInComboStatic::OnPaint() 
{
	CPaintDC dc(this);

	CFont * pf = GetFont();
	CFont  * of = dc.SelectObject(pf);
	CRect rc;
	GetClientRect(rc);
	dc.FillSolidRect(rc, GetSysColor(COLOR_WINDOW));
	int obk = dc.SetBkMode(TRANSPARENT);
	CString cs;
	GetWindowText(cs);
	dc.TextOut(0,0,cs);
	dc.SetBkMode(obk);
	dc.SelectObject(of);
}

BOOL CGfxInComboStatic::PreTranslateMessage(MSG* pMsg) 
{
	if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_CHAR)
	{
		if (pMsg->wParam == VK_UP)   pCombo->SetCurSel(pCombo->iCurSel - 1);
		if (pMsg->wParam == VK_DOWN) pCombo->SetCurSel(pCombo->iCurSel + 1);
		if (((char) pMsg->wParam >= 'a' && (char) pMsg->wParam >= 'z') || 
			((char) pMsg->wParam >= 'A' && (char) pMsg->wParam >= 'Z') ||
			((char) pMsg->wParam >= '0' && (char) pMsg->wParam >= '9'))
		{
			CString cs = pCombo->FindFromCharPressed((char) pMsg->wParam);
			if (cs != "") SetWindowText(cs);
		}
				
		::TranslateMessage(pMsg);
		::DispatchMessage(pMsg);
		return TRUE;
	}
	
	return CStatic::PreTranslateMessage(pMsg);
}

⌨️ 快捷键说明

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