📄 mytipwnd.cpp
字号:
// MyTipWnd.cpp : implementation file
//
#include "stdafx.h"
#include "c02ide.h"
#include "MyTipWnd.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyTipWnd
CMyTipWnd::CMyTipWnd()
{
}
CMyTipWnd::~CMyTipWnd()
{
}
BEGIN_MESSAGE_MAP(CMyTipWnd, CWnd)
//{{AFX_MSG_MAP(CMyTipWnd)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyTipWnd message handlers
BOOL CMyTipWnd::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
BOOL bRet = CWnd::CreateEx(NULL, "ppp", NULL, WS_POPUP, 0, 0, 0, 0,
pParentWnd->GetSafeHwnd(), NULL, NULL );
return bRet;
// return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
void CMyTipWnd::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect m_rcMargin(0,10,10,40);
// TODO: Add your message handler code here
CRect rc;
GetClientRect(&rc);
HGDIOBJ hGdi=GetStockObject(ANSI_FIXED_FONT);//选择等宽字体
dc.SelectObject(hGdi);
//填充背景色
dc.FillSolidRect(&rc,m_crBg);
//绘边框
rc.bottom--;
rc.right--;
dc.MoveTo(rc.left,rc.top);
dc.LineTo(rc.right,rc.top);
dc.LineTo(rc.right,rc.bottom);
dc.LineTo(rc.left,rc.bottom);
dc.LineTo(rc.left,rc.top);
//保留区域
rc.top++;
rc.left++;
rc.right--;
rc.bottom--;
//用户定义之页边距
rc.top+=m_rcMargin.top;
rc.bottom-=m_rcMargin.bottom;
rc.left+=m_rcMargin.left;
rc.right-=m_rcMargin.right;
dc.SetTextColor(m_crText);
char * m_strText="a";
dc.DrawText(m_strText,strlen(m_strText),&rc,0);
// Do not call CWnd::OnPaint() for painting messages
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -