?? gridurlcell.cpp
字號(hào):
// GridURLCell.cpp: implementation of the CGridURLCell class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "GridURLCell.h"
IMPLEMENT_DYNCREATE(CGridURLCell, CGridCell)
#ifndef _WIN32_WCE
HCURSOR CGridURLCell::g_hLinkCursor = NULL;
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CGridURLCell::CGridURLCell()
{
#ifndef _WIN32_WCE
g_hLinkCursor = GetHandCursor();
#endif
}
CGridURLCell::~CGridURLCell()
{
}
BOOL CGridURLCell::Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd)
{
SetTextClr(RGB(0,0,255));
return CGridCell::Draw(pDC, nRow, nCol, rect, bEraseBkgnd);
}
#pragma warning(disable:4100)
BOOL CGridURLCell::Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar)
{
return FALSE;
}
#pragma warning(default:4100)
void CGridURLCell::OnClick(CPoint /*PointCellRelative*/)
{
CString str = GetText();
if (str.Left(7) != _T("http://") && str.Left(7) != _T("mailto:") && str.Left(6) != _T("ftp://") )
str = _T("http://") + str;
#ifndef _WIN32_WCE
ShellExecute(NULL, _T("open"), str, NULL,NULL, SW_SHOW);
#endif
}
// Return TRUE if you set the cursor
BOOL CGridURLCell::OnSetCursor()
{
#ifdef _WIN32_WCE
return CGridCell::OnSetCursor();
#else
SetCursor(g_hLinkCursor);
return TRUE;
#endif
}
#ifndef _WIN32_WCE
HCURSOR CGridURLCell::GetHandCursor()
{
if (g_hLinkCursor == NULL) // No cursor handle - load our own
{
// Get the windows directory
CString strWndDir;
GetWindowsDirectory(strWndDir.GetBuffer(MAX_PATH), MAX_PATH);
strWndDir.ReleaseBuffer();
strWndDir += _T("\\winhlp32.exe");
// This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
HMODULE hModule = LoadLibrary(strWndDir);
if( hModule )
{
HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
if( hHandCursor )
{
g_hLinkCursor = CopyCursor(hHandCursor);
}
}
FreeLibrary(hModule);
}
return g_hLinkCursor;
}
#endif
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -