当前位置: 首页 > news >正文

珠海集团网站建设报价/月嫂免费政府培训中心

珠海集团网站建设报价,月嫂免费政府培训中心,wordpress很好的博客,万州论坛网站建设有时“关于”对话框中加入一些超链接(比如:网址或E-mail)。 一位高人写了一个CHyperLink非常好用,原理是用WinExec调用浏览器来访问超链接。 使用方法: 先把HyperLink.h和HyperLink.cpp两个文件add to projiect&…

有时“关于”对话框中加入一些超链接(比如:网址或E-mail)。
一位高人写了一个CHyperLink非常好用,原理是用WinExec调用浏览器来访问超链接。
使用方法:

  1. 先把HyperLink.h和HyperLink.cpp两个文件add to projiect,在需要的地方包含HyperLink.h;

  2. 修改一下静态文本的资源ID,用ClassWizard给要添加超链接的静态文本绑定变量,然后使它和一个CStatic类对象绑定,再把CStatic改为CHyperLink;

  3. OnInitDialog()中调用m_HyperLink.SetURL(“https://blog.csdn.net/chuhe163“);即可。
    链接Email,格式为mailto:XXX@XXX.com

CHyperLink.h

#pragma once
// CHyperLink
class CHyperLink : public CStatic
{DECLARE_DYNAMIC(CHyperLink)public:CHyperLink();virtual ~CHyperLink();public:void SetURL(CString strURL);CString GetURL() const;void SetColor(COLORREF clr, BYTE clrItem);//设置颜色COLORREF GetColor(BYTE clrItem);//得到颜色// Overrides// ClassWizard generated virtual function overrides//{{AFX_VIRTUAL(CHyperLink)
protected:virtual void PreSubclassWindow();//}}AFX_VIRTUAL// Implementation
protected:int GotoURL(LPCTSTR url, int showcmd);// Protected attributes
protected:COLORREF m_clrHot;      // Link normal colorCOLORREF m_clrNor;      // Link active colorCOLORREF m_clrBG;       // Link active colorBOOL     m_bHot;                // Is the link active?CString  m_strURL;                  // Hyperlink URL string// Generated message map functions
protected://{{AFX_MSG(CHyperLink)afx_msg void OnMouseMove(UINT nFlags, CPoint point);afx_msg void OnLButtonUp(UINT nFlags, CPoint point);afx_msg void OnPaint();afx_msg LRESULT  OnMouseHover(WPARAM wParam, LPARAM lParam);afx_msg LRESULT  OnMouseLeave(WPARAM wParam, LPARAM lParam);afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);protected:DECLARE_MESSAGE_MAP()
};

CHyperLink.cpp

// HyperLink.cpp : 实现文件
//
#include "stdafx.h"
//#include "MyPlayer.h"
#include "HyperLink.h"
//上面三个头文件利用类向导创建的话会自动生成,如果是手动创建,需要添加
// CHyperLinkIMPLEMENT_DYNAMIC(CHyperLink, CStatic)CHyperLink::CHyperLink()
{m_bHot = FALSE;    // Control doesn't own the focus yetm_strURL.Empty();               // Set URL to an empty stringm_clrHot = RGB(0, 0, 255);m_clrNor = RGB(0, 0, 255);m_clrBG = RGB(240, 240, 240);
}CHyperLink::~CHyperLink()
{
}BEGIN_MESSAGE_MAP(CHyperLink, CStatic)//{{AFX_MSG_MAP(CHyperLink)ON_WM_MOUSEMOVE()ON_WM_LBUTTONUP()ON_WM_PAINT()ON_MESSAGE(WM_MOUSEHOVER, &OnMouseHover)ON_MESSAGE(WM_MOUSELEAVE, &OnMouseLeave)ON_WM_SETCURSOR()//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
void CHyperLink::PreSubclassWindow()
{// TODO: Add your specialized code here and/or call the base classDWORD dwStyle = GetStyle();::SetWindowLong(GetSafeHwnd(), GWL_STYLE, dwStyle | SS_NOTIFY);//  SetFont(GetParent()->GetFont());CStatic::PreSubclassWindow();
}void CHyperLink::OnMouseMove(UINT nFlags, CPoint point)
{TRACKMOUSEEVENT tme;tme.cbSize = sizeof(tme);tme.hwndTrack = m_hWnd;tme.dwFlags = TME_LEAVE | TME_HOVER;tme.dwHoverTime = 1;_TrackMouseEvent(&tme);//  CStatic::OnMouseMove(nFlags, point);
}//鼠标在上面
LRESULT CHyperLink::OnMouseHover(WPARAM wParam, LPARAM lParam)
{if (!m_bHot){m_bHot = TRUE;Invalidate();}return TRUE;
}//鼠标离开
LRESULT CHyperLink::OnMouseLeave(WPARAM wParam, LPARAM lParam)
{m_bHot = FALSE;Invalidate();return TRUE;
}void CHyperLink::OnLButtonUp(UINT nFlags, CPoint point)
{if (m_strURL.IsEmpty()){GetWindowText(m_strURL);}GotoURL(m_strURL, SW_SHOW);
}/////////////////////////////////////////////////////////////////////////////
// CHyperLink operationsvoid CHyperLink::SetURL(CString strURL)
{m_strURL = strURL;
}CString CHyperLink::GetURL() const
{return m_strURL;
}int CHyperLink::GotoURL(LPCTSTR url, int showcmd)
{HINSTANCE result = ShellExecute(NULL, _T("open"), url, NULL, NULL, showcmd);return (int)result;
}void CHyperLink::OnPaint()
{CPaintDC dc(this); // device context for painting   // TODO: Add your message handler code hereCFont* pFont = GetFont();CFont m_Font;if (pFont != NULL){LOGFONT lf;pFont->GetLogFont(&lf);lf.lfUnderline = m_bHot;if (m_Font.CreateFontIndirect(&lf))dc.SelectObject(m_Font);}if (m_bHot){dc.SetTextColor(m_clrHot);}else{dc.SetTextColor(m_clrNor);}dc.SetBkMode(TRANSPARENT);///准备工作CRect rect;CBrush BGBrush, *pOldBrush;int nTextLeft = 4, nTextTop = 2; //文字输出的位置this->GetClientRect(&rect);//画背景BGBrush.CreateSolidBrush(m_clrBG);pOldBrush = dc.SelectObject(&BGBrush);dc.FillRect(&rect, &BGBrush);dc.SelectObject(pOldBrush);BGBrush.DeleteObject();///输出文字TEXTMETRIC tm;dc.GetTextMetrics(&tm);CString strText;this->GetWindowText(strText);nTextTop = rect.top + (rect.Height() - tm.tmHeight) / 2;if (strText.GetLength()>0){dc.TextOut(nTextLeft, nTextTop, strText);}BGBrush.DeleteObject();m_Font.DeleteObject();
}BOOL CHyperLink::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{// TODO: Add your message handler code here and/or call defaultif (m_bHot){::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(32649)));return TRUE;}return CStatic::OnSetCursor(pWnd, nHitTest, message);
}
http://www.lbrq.cn/news/840943.html

相关文章:

  • 贵阳网站开发zu97/佛山网站优化
  • 长安网站建设多少钱/无锡百度推广开户
  • 徐州苏视网站建设/代写文章哪里找写手
  • 西安seo网站关键词优化/收录提交入口
  • 做网站哪个语言快/网络营销的三种方式
  • 贵阳市网站做的最好的/简单的网页设计作品
  • 做seo网站的步骤/百度一下照片识别
  • 建设牌安全带官方网站/百度网站推广排名优化
  • 如何自己做门户网站/网络营销方法
  • 网站被模仿怎么办/东莞seo靠谱
  • 公司做网站的费属于广告费么/百度指数可以用来干什么
  • 做黄色网站的违法吗/建立网站用什么软件
  • 网站建设用php建设优点/自助优化排名工具
  • wordpress单本小说主题/关键词首页优化
  • 网站建设的前后台代码/商丘网站优化公司
  • 图片站 wordpress/十大seo公司
  • 医药网站备案/媒体发稿公司
  • 做seo网站标题用什么符号/网盘搜索神器
  • 自己建立网站/百度客服号码
  • 做ps的素材哪个网站/好的推广平台
  • 十大购物网站排行榜/长沙百度seo
  • 惠州最专业的网站建设公司/网站优化及推广
  • wordpress 自动 tag/seo优化实训总结
  • 个人主页url指的是什么/seo排名赚app下载
  • 网站开发是分为前端和后端吗/南昌seo搜索优化
  • 镇江百度网站建设/郑州网络公司
  • 天津微信网站开发/如何做网络推广外包
  • 为什么要给企业建设网站/广告开户南京seo
  • 网站效果图制作/宁德市人民政府
  • 如何做简洁网站设计/企业网站如何优化
  • 算法竞赛备赛——【图论】求最短路径——Floyd算法
  • Python高级编程技巧探讨:装饰器、Patch与语法糖详解
  • Git版本控制完全指南:从入门到精通
  • 《设计模式之禅》笔记摘录 - 7.中介者模式
  • YAML 自动化用例中 GET vs POST 请求的参数写法差异
  • 随机链表的复制数据结构oj题(力口138)