资源简介
用c++开发的,非常实用的哦
不必要在自己费时开发了!
代码片段和文件信息
// Hyperlink.cpp : implementation file
//
// Hyperlink static control. Will open the default browser with the given URL
// when the user clicks on the link.
//
// Copyright (C) 1997 1998 Chris Maunder
// All rights reserved. May not be sold for profit.
//
// Thanks to P錶 K. T鴑der for auto-size and window caption changes.
//
// “GotoURL“ function by Stuart Patterson
// As seen in the August 1997 Windows Developer‘s Journal.
// Copyright 1997 by Miller Freeman Inc. All rights reserved.
// Modified by Chris Maunder to use TCHARs instead of chars.
//
// “Default hand cursor“ from Paul DiLascia‘s Jan 1998 MSJ article.
//
#include “stdafx.h“
#include “Hyperlink.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define TOOLTIP_ID 1
/////////////////////////////////////////////////////////////////////////////
// CHyperlink
CHyperlink::CHyperlink()
{
m_hlinkCursor = NULL; // No cursor as yet
m_crlinkColour = RGB( 0 0 238); // Blue
m_crVisitedColour = RGB( 85 26 139); // Purple
m_crHoverColour = ::GetSysColor(COLOR_HIGHLIGHT);
m_bOverControl = FALSE; // Cursor not yet over control
m_bVisited = FALSE; // Hasn‘t been visited yet.
m_bUnderline = TRUE; // Underline the link?
m_bAdjustToFit = TRUE; // Resize the window to fit the text?
m_strURL.Empty();
}
CHyperlink::~CHyperlink()
{
m_Font.Deleteobject();
}
BEGIN_MESSAGE_MAP(CHyperlink CStatic)
//{{AFX_MSG_MAP(CHyperlink)
ON_CONTROL_REFLECT(STN_CLICKED onclicked)
ON_WM_CTLCOLOR_REFLECT()
ON_WM_SETCURSOR()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CHyperlink message handlers
BOOL CHyperlink::PreTranslateMessage(MSG* pMsg)
{
m_ToolTip.RelayEvent(pMsg);
return CStatic::PreTranslateMessage(pMsg);
}
void CHyperlink::onclicked()
{
int result = (int)GotoURL(m_strURL SW_SHOW);
m_bVisited = (result > HINSTANCE_ERROR);
if (!m_bVisited) {
MessageBeep(MB_ICONEXCLAMATION); // Unable to follow link
ReportError(result);
} else
SetVisited(); // Repaint to show visited colour
}
HBRUSH CHyperlink::CtlColor(CDC* pDC UINT nCtlColor)
{
ASSERT(nCtlColor == CTLCOLOR_STATIC);
if (m_bOverControl)
pDC->SetTextColor(m_crHoverColour);
else if (m_bVisited)
pDC->SetTextColor(m_crVisitedColour);
else
pDC->SetTextColor(m_crlinkColour);
// transparent text.
pDC->SetBkMode(TRANSPARENT);
return (HBRUSH)GetStockobject(NULL_BRUSH);
}
void CHyperlink::onmousemove(UINT nFlags CPoint point)
{
CStatic::onmousemove(nFlags point);
if (m_bOverControl) // Curso
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2003-09-17 21:46 MyMeter
文件 3320 2000-11-28 11:02 MyMeter\Hyperli
文件 54784 2003-09-24 13:11 MyMeter\MyMeter.opt
文件 3284 2000-06-16 07:07 MyMeter\MemDC.h
文件 2835 2003-09-24 12:04 MyMeter\Meter.h
文件 13068 1999-03-12 14:08 MyMeter\Hyperli
文件 1372 2003-09-24 13:09 MyMeter\MyMeter.clw
文件 3597 2003-09-16 20:30 MyMeter\ReadMe.txt
文件 1335 2003-09-16 20:30 MyMeter\MyMeter.h
文件 16666 2003-09-24 12:05 MyMeter\Meter.cpp
文件 4486 2003-09-24 13:00 MyMeter\MyMeter.dsp
文件 1054 2003-09-16 20:30 MyMeter\StdAfx.h
文件 209 2003-09-16 20:30 MyMeter\StdAfx.cpp
文件 1399 2003-09-24 13:10 MyMeter\MyMeterDlg.h
文件 1904 2003-09-24 13:10 MyMeter\MyMeter.plg
文件 91136 2003-09-24 13:11 MyMeter\MyMeter.ncb
文件 539 2003-09-16 21:23 MyMeter\MyMeter.dsw
文件 2077 2003-09-16 21:24 MyMeter\MyMeter.cpp
文件 731 2003-09-24 13:05 MyMeter\Resource.h
目录 0 2003-09-17 21:46 MyMeter\res
文件 399 2003-09-16 20:30 MyMeter\res\MyMeter.rc2
文件 1078 2003-09-16 20:30 MyMeter\res\MyMeter.ico
目录 0 2003-09-23 21:40 MyMeter\Debug
文件 35556 2003-09-24 13:05 MyMeter\MyMeter.aps
文件 5312 2003-09-24 13:05 MyMeter\MyMeter.rc
文件 5244 2003-09-24 13:10 MyMeter\MyMeterDlg.cpp
----------- --------- ---------- ----- ----
251385 26
- 上一篇:c++ 连接sql server 数据库代码
- 下一篇:PT100温度传感器驱动
评论
共有 条评论