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

📄 lbaybutton.cpp

📁 码头手持机项目,用于统计集装箱,轮船的情况,手持机采用S3C2440处理器,数据传输采用2.4G无线,上位机用VC编写
💻 CPP
字号:
// LbayButton.cpp : implementation file
//

#include "stdafx.h"
#include "CTSClient.h"
#include "LbayButton.h"

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

/////////////////////////////////////////////////////////////////////////////
// CLbayButton

CLbayButton::CLbayButton()
{
	m_red.CreateSolidBrush(RGB(153,51,0));
	//m_gray.CreateSolidBrush(RGB(200,200,200));
	//m_gray.CreateSolidBrush(RGB(174,174,174));
	m_gray.CreateSolidBrush(RGB(22,100,145));
}

CLbayButton::~CLbayButton()
{
	m_red.DeleteObject();
	m_gray.DeleteObject();
}


BEGIN_MESSAGE_MAP(CLbayButton, CButton)
	//{{AFX_MSG_MAP(CLbayButton)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLbayButton message handlers

void CLbayButton::PreSubclassWindow() 
{
	// TODO: Add your specialized code here and/or call the base class
	ModifyStyle(0, BS_OWNERDRAW);
	CButton::PreSubclassWindow();
}

void CLbayButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
	CDC dc;
    dc.Attach(lpDrawItemStruct->hDC );
	CRect rect;
	GetClientRect(rect);
	if(!stateflag)
	{
		dc.FillRect(rect,&m_gray);
	}
	else
	{
	    dc.FillRect(rect,&m_red);
	}
	CString btnstr;
	GetWindowText(btnstr);
	if (btnstr!="")
	{
        dc.SetBkMode(TRANSPARENT);
		dc.SetTextColor(RGB(0,0,255));
        dc.DrawText(btnstr,&rect,DT_VCENTER | DT_CENTER | DT_SINGLELINE);
	}
}

⌨️ 快捷键说明

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