当前位置:网站首页>Vs2019 MFC IP address Control Control inherit cipaddressctrl class redessine
Vs2019 MFC IP address Control Control inherit cipaddressctrl class redessine
2022-06-12 07:25:00 【Lzc 881012】
CMyIPAddressCtrl.hClasse d'héritagehFichier d 'en - tête
#include"MacroDefinition.h"
#pragma once
class CMyIPAddressCtrl:public CIPAddressCtrl
{
DECLARE_DYNAMIC(CMyIPAddressCtrl)
public:
CMyIPAddressCtrl();
virtual ~CMyIPAddressCtrl();
CBrush m_NrBkBrush;
CBrush m_SlBkBrush;
BOOL m_SelectedFlag;
CFont* p_Font;
COLORREF m_SlTextCtrl;
COLORREF m_UnSlTextCtrl;
COLORREF m_SlTextBkCtrl;
COLORREF m_UnSlTextBkCtrl;
CFont m_Text;
protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
void SetTextNrBackColor(COLORREF eTextNrBkCtrl);
void SetTextSlBackColor(COLORREF eTextSlBkCtrl);
void SetTextNrColor(COLORREF eNrTextCtrl);
void SetTextSlColor(COLORREF eSlTextColor);
void SetIPAddressCtrlBackColorNormal(COLORREF iPAddressBkCtrlNormal);
void SetIPAddressCtrlBackColorSelect(COLORREF iPAddressBkCtrlSelect);
bool SetTextFont(LONG nHeight, bool bBold, bool bItalic, bool bunderline ,const CString& sFaceName);
bool SetTextFont(CFont *m_cfont);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnMouseLeave();
};
CMyIPAddressCtrl.CPPDocuments de mise en œuvre
#include "pch.h"
#include "CMyIPAddressCtrl.h"
IMPLEMENT_DYNAMIC(CMyIPAddressCtrl, CIPAddressCtrl);
CMyIPAddressCtrl::CMyIPAddressCtrl()
{
m_SelectedFlag = FALSE;
SetIPAddressCtrlBackColorNormal(RGB(150,130,50));
SetIPAddressCtrlBackColorSelect(RGB(0,0,255));
SetTextNrBackColor(RGB(150, 130, 50));
SetTextSlBackColor(RGB(0, 0, 255));
SetTextNrColor(RGB(0, 0, 255));
SetTextSlColor(RGB(255, 0, 0));
p_Font = NULL;
p_Font = new CFont;
}
CMyIPAddressCtrl::~CMyIPAddressCtrl()
{
p_Font->Detach();
p_Font->DeleteObject();
p_Font = NULL;
m_NrBkBrush.DeleteObject();
m_SlBkBrush.DeleteObject();
}
BEGIN_MESSAGE_MAP(CMyIPAddressCtrl, CIPAddressCtrl)
ON_WM_CTLCOLOR()
ON_WM_MOUSEMOVE()
ON_WM_MOUSELEAVE()
END_MESSAGE_MAP()
HBRUSH CMyIPAddressCtrl::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
pDC->SetBkMode(TRANSPARENT);
if (m_SelectedFlag==FALSE)
{ pDC->SetTextColor(m_UnSlTextCtrl);
pDC->SetBkColor(m_UnSlTextBkCtrl);
return(HBRUSH)m_NrBkBrush;
}
else
{
pDC->SetTextColor(m_SlTextCtrl);
pDC->SetBkColor(m_SlTextBkCtrl);
return(HBRUSH)m_SlBkBrush;
}
}
void CMyIPAddressCtrl::SetTextNrBackColor(COLORREF eTextNrBkCtrl)
{
m_UnSlTextBkCtrl = eTextNrBkCtrl;
}
void CMyIPAddressCtrl::SetTextSlBackColor(COLORREF eTextSlBkCtrl)
{
m_SlTextBkCtrl = eTextSlBkCtrl;
}
void CMyIPAddressCtrl::SetTextNrColor(COLORREF eNrTextCtrl)
{
m_UnSlTextCtrl = eNrTextCtrl;
}
void CMyIPAddressCtrl::SetTextSlColor(COLORREF eSlTextColor)
{
m_SlTextCtrl = eSlTextColor;
}
void CMyIPAddressCtrl::SetIPAddressCtrlBackColorNormal(COLORREF iPAddressBkCtrlNormal)
{
m_NrBkBrush, Detach();
m_NrBkBrush.CreateSolidBrush(iPAddressBkCtrlNormal);
}
void CMyIPAddressCtrl::SetIPAddressCtrlBackColorSelect(COLORREF iPAddressBkCtrlSelect)
{
m_SlBkBrush.Detach();
m_SlBkBrush.CreateSolidBrush(iPAddressBkCtrlSelect);
}
bool CMyIPAddressCtrl::SetTextFont(LONG nHeight, bool bBold, bool bItalic,bool bunderline, const CString& sFaceName)
{
p_Font->CreateFontW(nHeight, 0, 0, 0, bBold, bItalic, bunderline, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, sFaceName);
return this->SetTextFont(p_Font);
}
bool CMyIPAddressCtrl::SetTextFont(CFont *m_cfont)
{
this->SetFont(m_cfont, TRUE);
return true;
}
void CMyIPAddressCtrl::OnMouseMove(UINT nFlags, CPoint point)
{
TRACKMOUSEEVENT csTME;
if (!m_SelectedFlag)
{
m_SelectedFlag = TRUE;
Invalidate();
csTME.cbSize = sizeof(csTME);
csTME.dwFlags = TME_LEAVE;
csTME.hwndTrack = m_hWnd;
csTME.dwHoverTime = 1;
::_TrackMouseEvent(&csTME);
}
CIPAddressCtrl::OnMouseMove(nFlags, point);
}
void CMyIPAddressCtrl::OnMouseLeave()
{
if (m_SelectedFlag)
{
m_SelectedFlag = FALSE;
Invalidate();
}
CIPAddressCtrl::OnMouseLeave();
}
边栏推荐
- Detailed explanation of 8086/8088 system bus (sequence analysis + bus related knowledge)
- 5、 El expression & JSTL tag library
- Understanding management - four dimensions of executive power
- [image detection] SAR image change detection based on depth difference and pcanet with matlab code
- Design an open source continuous deployment pipeline based on requirements
- Vscode outline preview cannot find file symbol
- Go common usage
- Installation and use of eigen under vs2017
- Jackson XML is directly converted to JSON without writing entity classes manually
- Improved schemes for episodic memory based lifelong learning
猜你喜欢

Formatting the generalization forgetting trade off in continuous learning
![‘CMRESHandler‘ object has no attribute ‘_timer‘,socket.gaierror: [Errno 8] nodename nor servname pro](/img/de/6756c1b8d9b792118bebb2d6c1e54c.png)
‘CMRESHandler‘ object has no attribute ‘_timer‘,socket.gaierror: [Errno 8] nodename nor servname pro

1. Foundation of MySQL database (1- installation and basic operation)

Modelarts培训任务1

FCPX插件:简约线条呼出文字标题介绍动画Call Outs With Photo Placeholders for FCPX

Introduction to JDE object management platform and use of from

RT thread studio learning (IX) TF Card File System

Federated reconnaissance: efficient, distributed, class incremental learning paper reading + code analysis

Interview computer network - transport layer

There is no solid line connection between many devices in Proteus circuit simulation design diagram. How are they realized?
随机推荐
Gradient epic memory for continuous learning
Static coordinate transformation in ROS (analysis + example)
RT thread studio learning (VIII) connecting Alibaba cloud IOT with esp8266
Lambda function perfect use guide
Source code learning - [FreeRTOS] privileged_ Understanding of function meaning
Planning and design of 1000 person medium-sized campus / enterprise network based on ENSP and firewall (with all configuration commands)
Thoroughly understand the "rotation matrix / Euler angle / quaternion" and let you experience the beauty of three-dimensional rotation
Map to sort
5、 El expression & JSTL tag library
Can official account also bring goods?
node:打不开/node:已拒绝访问
2022起重机械指挥考试题模拟考试平台操作
[image denoising] image denoising based on nonlocal Euclidean median (nlem) with matlab code
RT thread studio learning (IX) TF Card File System
SQL -- course experiment examination
5 lines of code identify various verification codes
Unable to load bean of class marked with @configuration
Understanding management - four dimensions of executive power
[wax chain tour] release a free and open source alien worlds script TLM
Golang quickly generates model and queryset of database tables