?? 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 + -