close

 

 

逐漸在收尾,所以來將一些簡單的應用整理。

 

 


#ifndef FOCUSEDITCTRL_H_
#define FOCUSEDITCTRL_H_




class CFocusEditCtrl : public CEdit
{
// Construction
public:
	CFocusEditCtrl();
 
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CFocusEditCtrl)
	public:
	 

// Implementation
public:
	virtual ~CFocusEditCtrl();

	// Generated message map functions
protected:
	//{{AFX_MSG(CFocusEditCtrl)
 
	afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
 
 

	DECLARE_MESSAGE_MAP()

	CString	m_sExcludeCharMask;								// Exclusion Character Mask
	CString	m_sIncludeCharMask;								// Inclusion Character Mask
	CBrush	m_brBGBrush;									// Background Brush
	 

	private:
		CFocusEditCtrl(const CFocusEditCtrl& rSrc);
		CFocusEditCtrl&		operator = (const CFocusEditCtrl& rSrc);
};


#endif // !FOCUSEDITCTRL_H_

 

 

 

 

 

 
 
#include	"StdAfx.h"
#include	"FocusEditCtrl.h"

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

static	COLORREF	g_crATColor = RGB( 0xFF, 0xFF, 0xFF );	// Active (Focused) Text Color
static	COLORREF	g_crABColor = RGB( 0x00, 0x00, 0x00 );	// Active (Focused) Background Color



CFocusEditCtrl::CFocusEditCtrl()
{
	m_brBGBrush.CreateSolidBrush( g_crABColor );			// Create Active BG Brush
	return;													// Done!
}


CFocusEditCtrl::~CFocusEditCtrl()
{
}

  

BEGIN_MESSAGE_MAP(CFocusEditCtrl, CEdit)
	ON_WM_CREATE()
	ON_WM_CTLCOLOR_REFLECT()
	ON_WM_ERASEBKGND()
END_MESSAGE_MAP()


HBRUSH CFocusEditCtrl::CtlColor(CDC* pDC, UINT /*nCtlColor*/ ) 
{
	DWORD	dwStyle = GetStyle();
	{
		pDC -> SetTextColor( g_crATColor );					// Set Text Color
		pDC -> SetBkColor( g_crABColor );					// Set Background Color
		return( (HBRUSH)m_brBGBrush );						// Return Custom BG Brush
	}
	return( NULL );											// Do Default
}


BOOL CFocusEditCtrl::OnEraseBkgnd(CDC* pDC) 
{
	DWORD	dwStyle = GetStyle();
	CRect	rClient;
	BOOL	bStatus = TRUE;
	{
		GetClientRect( &rClient );							// Get Our Area
		pDC -> FillSolidRect( rClient, g_crABColor );		// Repaint Background
	}
	return( bStatus );										// Return Status
}

 
 
 
 


arrow
arrow
    創作者介紹
    創作者 Eric 的頭像
    Eric

    一個小小工程師的心情抒發天地

    Eric 發表在 痞客邦 留言(0) 人氣()