xstatic.cpp

来自「TAPI编程应用」· C++ 代码 · 共 50 行

CPP
50
字号
// xstatic.cpp : implementation file for CXstatic class
// (c) Dialogic corp 1995, 1996

#include "stdafx.h"
#include "xstatic.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CXstatic

CXstatic::CXstatic()
{
	m_Colorref = RGB(0, 0, 255);
}

CXstatic::~CXstatic()
{
}

BEGIN_MESSAGE_MAP(CXstatic, CStatic)
	//{{AFX_MSG_MAP(CXstatic)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CXstatic message handlers

void CXstatic::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	CRect rect;
	//dc.SetBkColor(RGB(255, 0, 0));
	GetClientRect(&rect);
	CBrush brush(m_Colorref);
	//CPen pen(PS_SOLID, 2, RGB(0, 0, 255));
	//dc.SelectObject(&pen);
	CBrush *pOldBrush = dc.SelectObject(&brush);
	if(NULL == pOldBrush) return;
	dc.Ellipse(rect);
	dc.SelectObject(pOldBrush);
	// Do not call CStatic::OnPaint() for painting messages
}

⌨️ 快捷键说明

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