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

📄 linknet.cpp

📁 动态鼠标
💻 CPP
字号:
// LinkNet.cpp : implementation file
//

#include "stdafx.h"
#include "KSComDlg.h"
#include "LinkNet.h"

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

/////////////////////////////////////////////////////////////////////////////
// CLinkNet

CLinkNet::CLinkNet()
{
	m_nTextColor=RGB(255,0,0);
	m_bCursorOn=false;
}

CLinkNet::~CLinkNet()
{

}


BEGIN_MESSAGE_MAP(CLinkNet, CStatic)
	//{{AFX_MSG_MAP(CLinkNet)
//	ON_WM_CTLCOLOR()
    ON_WM_CTLCOLOR_REFLECT()
	ON_WM_MOUSEMOVE()
	ON_WM_SETCURSOR()
	ON_WM_CAPTURECHANGED()
	ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLinkNet message handlers

//HBRUSH CLinkNet::CtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
HBRUSH CLinkNet::CtlColor(CDC* pDC, UINT nCtlColor) 
{
//	HBRUSH hbr = CStatic::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	if(m_bCursorOn)
	{
		pDC->SetTextColor(m_nTextColor);
	}
	else
	{
		pDC->SetTextColor(RGB(0,0,255));
	}
	
	pDC->SetBkMode(TRANSPARENT);
	// TODO: Return a non-NULL brush if the parent's handler should not be called
	return (HBRUSH)GetStockObject(NULL_BRUSH);
	// TODO: Return a different brush if the default is not desired
//	return hbr;
}

void CLinkNet::OnMouseMove(UINT nFlags, CPoint point) 
{
	if(m_bCursorOn)
	{
		CRect rect;
		GetWindowRect(&rect);

		rect.right-=rect.left;
		rect.bottom-=rect.top;
		rect.left=0;
		rect.top=0;

		if(!rect.PtInRect(point))
		{
			m_bCursorOn=false;
			::ReleaseCapture();
			this->Invalidate();
		}

	}
	else
	{
		m_bCursorOn=true;
		this->SetCapture();
		this->Invalidate();
	}

	CStatic::OnMouseMove(nFlags, point);
}

BOOL CLinkNet::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
	if(m_hCursor)
	{
		::SetCursor(m_hCursor);
		return true;
	}
	return CStatic::OnSetCursor(pWnd, nHitTest, message);
}

void CLinkNet::OnCaptureChanged(CWnd *pWnd) 
{
	m_bCursorOn=false;
	::ReleaseCapture();
	this->Invalidate();

	CStatic::OnCaptureChanged(pWnd);
}

void CLinkNet::OnClicked() 
{
	CString CmdLine,HyperLink;

	GetWindowText(HyperLink);
	CmdLine.Format("Explorer.exe %s",HyperLink.GetBuffer(0));
	WinExec(CmdLine.GetBuffer(0),SW_NORMAL);
}

⌨️ 快捷键说明

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