mycolor.cpp

来自「一个基于VC++的电子钟程序。采用LED显示。以单片机为核心。」· C++ 代码 · 共 71 行

CPP
71
字号
// MyColor.cpp: implementation of the MyColor class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "MyColor.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

MyColor::MyColor()
{
    
	c[0]=RGB(149,232,23);
	c[1]=RGB(108,240,240);
	c[2]=RGB(127,240,59);
	c[3]=RGB(4,242,51);
	c[4]=RGB(238,200,145);
	c[5]=RGB(137,149,245);
	c[6]=RGB(18,39,220);
	c[7]=RGB(58,78,239);
	c[8]=RGB(242,63,243);
	c[9]=RGB(240,66,136);
	
	
	
}

MyColor::~MyColor()
{

}

void MyColor::SetDlgBackgroundColor(CDialog *dlg,COLORREF CR)//设置对话框背景颜色,使用时调用SetBackgroundColor(this)
{
	CRect rect;
    CPaintDC dc(dlg);
    dlg->GetClientRect(rect);
    dc.FillSolidRect(rect,CR); 

}





void MyColor::PaintStatic(CWnd *dlg,COLORREF cr,CString str)
{
		CClientDC dc(dlg);
		CRect rect;
		dlg->GetClientRect(&rect);
        CPen pen(PS_SOLID,1,RGB(50,0,10+100));
        dc.SelectObject(&pen);
       CBrush pBrush(cr);
	   //=new CBrush(cr);
       dc.SelectObject(&pBrush);
       dc.Rectangle(rect);
	   dc.SetBkMode(TRANSPARENT);
	   dc.TextOut(rect.left+10,rect.top+5,str);
      
	 

}

⌨️ 快捷键说明

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