⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 neweditbutton.cpp

📁 电脑编程技巧和源码。很不错的。
💻 CPP
字号:
// NewEditButton.cpp : implementation file
//

#include "stdafx.h"
#include "Monitor.h"
#include "NewEditButton.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CNewEditButton

CNewEditButton::CNewEditButton()
{
	cTool = new CToolTipCtrl;
	bChosen=FALSE;
}

CNewEditButton::~CNewEditButton()
{
}


BEGIN_MESSAGE_MAP(CNewEditButton, CStatic)
	//{{AFX_MSG_MAP(CNewEditButton)
	ON_WM_PAINT()
	ON_WM_LBUTTONUP()
	ON_WM_CREATE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CNewEditButton message handlers
void CNewEditButton::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	CRect r;
	GetClientRect(r);
	r.left-=1;
	r.right+=1;
	r.bottom+=1;
	r.top-=1;
	dc.FillSolidRect(r,RGB(252,252,252));
	CString type;
	GetWindowText(type);
	dc.SetBkMode(TRANSPARENT);
	if(bChosen)
	{
		dc.SetBkColor(RGB(255,255,255));
		dc.SetTextColor(RGB(230,210,210));
		dc.TextOut(0,0,type);
		dc.SetTextColor(RGB(255,0,0));
		dc.TextOut(1,1,type);
	}
	else
	{
		dc.SetBkColor(RGB(255,255,255));
		dc.SetTextColor(RGB(230,210,210));
		dc.TextOut(0,0,type);
		dc.SetTextColor(RGB(150,150,150));
		dc.TextOut(-1,-1,type);
	}
	// Do not call CStatic::OnPaint() for painting messages
}

void CNewEditButton::OnLButtonUp(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	bChosen=!bChosen;
	CWnd *pFather=GetParent();
	UINT id=GetDlgCtrlID();
	::SendNotifyMessage(pFather->m_hWnd,CHOOSE_TYPE,id+100,bChosen);
	::SendNotifyMessage(pFather->m_hWnd,CHOOSE_TYPE,id+200,bChosen);
	InvalidateRect(NULL);
	
	CStatic::OnLButtonUp(nFlags, point);
}

int CNewEditButton::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CStatic::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	if(cTool->Create(this, TTS_ALWAYSTIP | WS_POPUP | WS_EX_TOOLWINDOW))
	cTool->Activate(TRUE);
	cTool->AddTool(this,"待使用");
	cTool->SetMaxTipWidth(150);
	cTool->SetDelayTime(0);
	cTool->SetDelayTime(TTDT_AUTOPOP,30000);

	
	return 0;
}

BOOL CNewEditButton::PreTranslateMessage(MSG* pMsg) 
{
	cTool->RelayEvent(pMsg);	
	return CStatic::PreTranslateMessage(pMsg);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -