superlink.h

来自「VC-Car VC完整MIS应用程序代码」· C头文件 代码 · 共 87 行

H
87
字号
#if !defined(AFX_SUPERLINK_H__CC999102_121F_11D5_9F99_5254ABDD22CE__INCLUDED_)
#define AFX_SUPERLINK_H__CC999102_121F_11D5_9F99_5254ABDD22CE__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/*
 *	Use: int function OnInitDialog() add:
 *	CSuper m_test; (in *.h file)
 *
 *	m_test.SubclassDlgItem(IDC_TEST_LINK,this);  
 *	m_test.SetSuperLink(TRUE); 
 *	m_test.SetLinkCursor(AfxGetApp()->LoadCursor(IDC_CURSOR_HAND)); 
 *	m_test.SetLinkAddress("http://www.china.com/");
 *
 */

// SuperLink.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CSuperLink window

class CSuperLink : public CStatic
{
// Construction
public:
	CSuperLink();
	CSuperLink(COLORREF crClicked, COLORREF crMoveOn, COLORREF crOordinary);

// Attributes
public:
	COLORREF m_crText;

	BOOL SetLinkAddress(CString strLink); 

	void MouseLeave(void);
	void MouseEnter(void);
	void SetLinkCursor(HCURSOR hCursor); 

	void SetSuperLink(BOOL setlink);
	
protected:
	CString m_linktext;		// shell 调用的联接参数
	BOOL m_bClicked;		// 鼠标是否单击超联接
	HCURSOR m_hCursor;		// 鼠标移动到超联接上时的鼠标形状

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSuperLink)
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CSuperLink();

	// Generated message map functions
protected:
	//{{AFX_MSG(CSuperLink)
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()

protected:
	BOOL m_bcaptured;				//捕捉鼠标移动
	COLORREF m_crClicked;			//单击超联接后文本的颜色
	COLORREF m_crMoveOn;			//鼠标移动到超联接时的文本的颜色
	COLORREF m_crOrdinary	;		//未激活超联接时文本的颜色
	LOGFONT		m_lf;          
	CFont		m_font;				//超联接上的文本的字体
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SUPERLINK_H__CC999102_121F_11D5_9F99_5254ABDD22CE__INCLUDED_)

⌨️ 快捷键说明

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