📄 hyperlink.h
字号:
// HyperLink.h : header file
/*
超级连接控件
修改:邓振波
功能:一个功能齐全的超级连接控件,
支持各种状态下的颜色(鼠标进入、离开、点击后)、
字体、字形(斜体、下划线)、鼠标形状、提示信息
具体使用参见示例,跟普通的控件使用一样
参考:wwww.vchelp.net上代码修改
*/
#if !defined(AFX_HYPERLINK_H_04ET323B01_023500_0204251998_ENm_INCLUDED_)
#define AFX_HYPERLINK_H_04ET323B01_023500_0204251998_ENm_INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
/////////////////////////////////////////////////////////////////////////////
// CHyperLink window
class CHyperLink : public CStatic
{
DECLARE_DYNAMIC(CHyperLink)
public:
// 连接控件的风格
static const DWORD STYLEUNDERLINE;
static const DWORD STYLEUSEHOVER;
static const DWORD STYLEAUTOSIZE;
static const DWORD STYLEDOWNCLICK;
static const DWORD STYLEGETFOCUSONCLICK;
static const DWORD STYLENOHANDCURSOR;
static const DWORD STYLENOACTIVECOLOR;
// Construction/destruction
CHyperLink();
virtual ~CHyperLink();
// Attributes
public:
// Operations
public:
static void GetColors(COLORREF &crLink,COLORREF &crActive,COLORREF &crVisited,COLORREF &crHover);
static HCURSOR GetLinkCursor();
static void SetLinkCursor(HCURSOR hCursor);
static void SetColors(COLORREF crLinkColor, COLORREF crActiveColor,
COLORREF crVisitedColor, COLORREF crHoverColor = -1);
void SetURL(CString strURL);
CString GetURL() const;
DWORD GetLinkStyle() const;
BOOL ModifyLinkStyle(DWORD dwRemove, DWORD dwAdd, BOOL bApply=TRUE);
void SetWindowText(LPCTSTR lpszText);
void SetFont(CFont *pFont);
BOOL IsVisited() const;
void SetVisited(BOOL bVisited = TRUE);
//如果你想SubClass,可以使用该函数并设置URL
BOOL SubclassDlgItem(UINT nID, CWnd* pParent, LPCTSTR lpszURL=NULL)
{
m_strURL = lpszURL;
return CStatic::SubclassDlgItem(nID, pParent);
}
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CHyperLink)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void PreSubclassWindow();
//}}AFX_VIRTUAL
// Implementation
protected:
static void SetDefaultCursor();
static HINSTANCE GotoURL(LPCTSTR url, int showcmd);
void AdjustWindow();
void FollowLink();
inline void SwitchUnderline();
// Protected attributes
protected:
static COLORREF m_crLinkColor; // 通常颜色
static COLORREF m_crActiveColor; // 连接活动颜色
static COLORREF m_crVisitedColor; // 浏览过颜色
static COLORREF m_crHoverColor; // 掠过颜色
static HCURSOR m_hLinkCursor; // 鼠标形状
BOOL m_bLinkActive; // 是否活动
BOOL m_bOverControl; // 是否鼠标掠过
BOOL m_bVisited; // 是否可见
DWORD m_dwStyle; // 风格
CString m_strURL; // 连接的目标URL
CFont m_Font; // 下划线
CToolTipCtrl m_ToolTip; // 工具提示
// Generated message map functions
protected:
//{{AFX_MSG(CHyperLink)
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg UINT OnNcHitTest(CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line
#endif // !defined(AFX_HYPERLINK_H_04ET323B01_023500_0204251998_ENm_INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -