www.gusucode.com > VC++挂机锁屏系统源程序源码程序 > VC++挂机锁屏系统源程序源码程序\code\HoverEdit.cpp

    //Download by http://www.NewXing.com
// HoverEdit.cpp : implementation file
//
/*----------------------------------------------------------------------------*/
//
//	文件:		HoverEdit.cpp
//	修改者:		蔡亦汤
//	修改时间:	2007年4月7日
//  EMAIL:      caiyitang2003@163.com
/*----------------------------------------------------------------------------*/

///////////////////////////////////////功能说明 ////////////////////////////////////////
//使编辑控件有热点功能
////////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "HoverEdit.h"

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

/////////////////////////////////////////////////////////////////////////////
// CHoverEdit

CHoverEdit::CHoverEdit()
{
}

CHoverEdit::~CHoverEdit()
{
}

BEGIN_MESSAGE_MAP(CHoverEdit, CEdit)
//{{AFX_MSG_MAP(CHoverEdit)
ON_WM_NCPAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CHoverEdit message handlers
//有热点
void CHoverEdit::OnHoverEnter()  
{
	Redraw();           //重画编辑控件窗口
}

//没有热点
void CHoverEdit::OnHoverLeave() 
{
	Redraw();          //重画编辑控件窗口
}

//重画编辑控件窗口
void CHoverEdit::Redraw()
{
	RedrawWindow(NULL,NULL,RDW_FRAME|RDW_INVALIDATE);
}

//重绘窗口非客户区
void CHoverEdit::OnNcPaint() 
{
	CWindowDC DC(this);
	CRect Rect;
	GetWindowRect(&Rect);
	if (IsHover())    //没有热点
		DC.Rectangle(0,0,Rect.Width(),Rect.Height());    //在编辑控件窗口画一个矩形重叠
	else   
		//重画编辑控件窗口内边界凹下
		DC.DrawEdge(CRect(0,0,Rect.Width(),Rect.Height()),EDGE_SUNKEN,BF_FLAT|BF_RECT);  
}