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

📄 myedit.cpp

📁 操作系统课程设计:死锁问题。 哲学家进餐问题的解决!!!很好的操作系统大作业!
💻 CPP
字号:
// MyEdit.cpp : implementation file
//

#include "stdafx.h"
#include "060341223.h"
#include "MyEdit.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyEdit

CMyEdit::CMyEdit()
{
	m_ForeColor = RGB(0,0,0);            //文字颜色(黑色)
    m_BackColor = RGB(255,255,255);      //背景色(白色)
    m_BkBrush.CreateSolidBrush(m_BackColor);    //背景刷
	p_Font = NULL;								//字体指针
}

CMyEdit::~CMyEdit()
{
		if ( p_Font )	delete p_Font;		//删除字体
}


BEGIN_MESSAGE_MAP(CMyEdit, CEdit)
	//{{AFX_MSG_MAP(CMyEdit)
	ON_WM_CTLCOLOR_REFLECT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyEdit message handlers

HBRUSH CMyEdit::CtlColor(CDC* pDC, UINT nCtlColor) 
{
	// TODO: Change any attributes of the DC here
	 pDC->SetTextColor( m_ForeColor );         //设置文字颜色
    pDC->SetBkColor( m_BackColor );           //设置背景色
    return (HBRUSH)m_BkBrush.GetSafeHandle(); //返回背景刷
	// TODO: Return a non-NULL brush if the parent's handler should not be called
	return NULL;
}

void CMyEdit::SetBkColor(COLORREF color)
{
m_BackColor = color;
    m_BkBrush.Detach();           //分离原背景刷
    m_BkBrush.CreateSolidBrush( m_BackColor ); //建立背景刷
}

void CMyEdit::SetForeColor(COLORREF color)
{
 m_ForeColor = color;     	

}
//
//
void CMyEdit::SetTextFont(int FontHight,LPCTSTR FontName)
{
		if ( p_Font )	delete p_Font;		//删除旧字体
	p_Font = new CFont;			//生成字体对象
	p_Font->CreatePointFont( FontHight, FontName );	//创建字体
	SetFont( p_Font );			//设置控件字体

}


void CMyEdit::set_wenben()
{
     SetBkColor(RGB(173,240,248));
	 SetTextFont( 90, _T("宋体") );
}

⌨️ 快捷键说明

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