📄 mystatic.cpp
字号:
// MyStatic.cpp : implementation file
//
#include "stdafx.h"
#include "testd.h"
#include "MyStatic.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyStatic
CMyStatic::CMyStatic()
{
behead=false;
issub=false;
}
CMyStatic::~CMyStatic()
{
}
BEGIN_MESSAGE_MAP(CMyStatic, CStatic)
//{{AFX_MSG_MAP(CMyStatic)
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
ON_WM_SETCURSOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyStatic message handlers
void CMyStatic::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CStatic::OnPaint() for painting messages
GetWindowText(word);
dc.SetBkMode(TRANSPARENT);
if(behead)
{
CFont font;
font.CreateFont(25,
0,
0,
0,
FW_BOLD,
true,
false,
0,ANSI_CHARSET,
OUT_DEVICE_PRECIS,
CLIP_CHARACTER_PRECIS,
PROOF_QUALITY,
DEFAULT_PITCH | FF_SWISS,
"");
CFont *deffont=dc.SelectObject(&font);
dc.SetTextColor(RGB(160,160,160));
dc.TextOut(0,0,word);
dc.SelectObject(deffont);
font.DeleteObject();
}
else
{
if(this->GetDlgCtrlID()==IDC_LINK)
{
LOGFONT ft;
GetFont()->GetLogFont(&ft);
ft.lfUnderline=true;
CFont font;
font.CreateFontIndirect(&ft);
CFont *deffont=dc.SelectObject(&font);
dc.SetTextColor(RGB(255,255,0));
font.DeleteObject();
}
if(this->GetDlgCtrlID()!=IDC_LINK&&this->GetDlgCtrlID()!=IDC_MOOD)
{
LOGFONT ft;
GetFont()->GetLogFont(&ft);
CFont font;
font.CreateFontIndirect(&ft);
CFont *deffont=dc.SelectObject(&font);
dc.SetTextColor(RGB(201,211,211));
font.DeleteObject();
}
dc.TextOut(0,0,word);
}
}
void CMyStatic::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(issub)
ShellExecute(NULL, "open", "mailto:gjswh_hl@163.com", NULL, NULL, SW_SHOWNORMAL);
CStatic::OnLButtonDown(nFlags, point);
}
BOOL CMyStatic::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
if(issub)
{
HCURSOR cr=AfxGetApp()->LoadCursor(IDC_MYCURSOR);
::SetCursor(cr);
return true;
}
return CStatic::OnSetCursor(pWnd, nHitTest, message);
}
void CMyStatic::PreSubclassWindow()
{
// TODO: Add your specialized code here and/or call the base class
DWORD dwStyle = GetStyle();
::SetWindowLong(m_hWnd, GWL_STYLE, dwStyle | SS_NOTIFY);
CStatic::PreSubclassWindow();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -