HyperLink.h
Upload User: taoguanmin
Upload Date: 2007-05-11
Package Size: 180k
Code Size: 3k
Category:

2D Graphic

Development Platform:

Visual C++

  1. #if !defined(AFX_HYPERLINK_H__91C79E53_3E00_4E28_8CC7_61874C808806__INCLUDED_)
  2. #define AFX_HYPERLINK_H__91C79E53_3E00_4E28_8CC7_61874C808806__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // HyperLink.h : header file
  7. //
  8. /////////////////////////////////////////////////////////////////////////////
  9. // CHyperLink window
  10. //超链接类别
  11. #define HLS_URL  1//网页
  12. #define HLS_MAIL 2//邮件
  13. class CHyperLink : public CStatic
  14. {
  15. // Construction
  16. public:
  17. CHyperLink();
  18. virtual ~CHyperLink();
  19. // Attributes
  20. public:
  21. // Operations
  22. public:
  23.     void SetURL(CString strURL);
  24.     CString GetURL() const{return m_strURL;};
  25. void SetMail(CString strMail);
  26. CString GetMail() const{return m_strMail;};
  27.     void SetColours(COLORREF crLinkColour,COLORREF crVisitedColour,COLORREF crHoverColour=-1);
  28.     COLORREF GetLinkColour() const{return m_crLinkColour;};
  29.     COLORREF GetVisitedColour() const{return m_crVisitedColour;};
  30.     COLORREF GetHoverColour() const{return m_crHoverColour;};
  31.     void SetVisited(BOOL bVisited=TRUE);
  32.     BOOL GetVisited() const{return m_bVisited;};
  33.     void SetLinkCursor(HCURSOR hCursor);
  34.     HCURSOR GetLinkCursor() const{return m_hLinkCursor;};
  35.     void SetUnderline(BOOL bUnderline=TRUE);
  36.     BOOL GetUnderline() const{return m_bUnderline;};
  37.     void SetAutoSize(BOOL bAutoSize=TRUE);
  38.     BOOL GetAutoSize() const{return m_bAdjustToFit;};
  39. HINSTANCE GotoURL(LPCTSTR url,int showcmd);
  40. void GotoMail(CString strMail,int iShowCmd);
  41. // Overrides
  42. // ClassWizard generated virtual function overrides
  43. //{{AFX_VIRTUAL(CHyperLink)
  44. public:
  45. virtual BOOL PreTranslateMessage(MSG* pMsg);
  46. protected:
  47. virtual void PreSubclassWindow();
  48. //}}AFX_VIRTUAL
  49. // Implementation
  50. // Generated message map functions
  51. protected:   
  52.     void ReportError(int nError);
  53.     LONG GetRegKey(HKEY key,LPCTSTR subkey,LPTSTR retdata);
  54.     void PositionWindow();
  55.     void SetDefaultCursor();
  56. // Protected attributes
  57. protected:
  58. int m_iHyperLinkSort;      //超链接类别
  59.     COLORREF m_crLinkColour;   //超链接颜色
  60. COLORREF m_crVisitedColour;//超链接被访问过后的颜色
  61.     COLORREF m_crHoverColour;  //Hover colour
  62.     BOOL m_bOverControl;       //cursor over control?
  63.     BOOL m_bVisited;           //此地址是否已被访问
  64.     BOOL m_bUnderline;         //是否加下划线
  65.     BOOL m_bAdjustToFit;       //Adjust window size to fit text?
  66.     CString m_strURL;          //超链接地址
  67. CString m_strMail;        //邮件地址
  68.     CFont m_Font;              //Underline font if necessary
  69.     HCURSOR m_hLinkCursor;     //超链接上的光标
  70.     CToolTipCtrl m_ToolTip;    //提示控件
  71. protected:
  72. //{{AFX_MSG(CHyperLink)
  73. afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
  74. afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  75. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  76. //}}AFX_MSG
  77.     afx_msg void OnClicked();
  78. DECLARE_MESSAGE_MAP()
  79. };
  80. /////////////////////////////////////////////////////////////////////////////
  81. //{{AFX_INSERT_LOCATION}}
  82. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  83. #endif // !defined(AFX_HYPERLINK_H__91C79E53_3E00_4E28_8CC7_61874C808806__INCLUDED_)