www.pudn.com > MCIWnd_MediaPlayer.rar > StaticEx.cpp


// StaticEx.cpp : 实现文件 
// 
 
#include "stdafx.h" 
#include "MediaPlayer.h" 
#include "StaticEx.h" 
#include ".\staticex.h" 
 
 
// CStaticEx 
 
IMPLEMENT_DYNAMIC(CStaticEx, CStatic) 
CStaticEx::CStaticEx() 
{ 
} 
 
CStaticEx::~CStaticEx() 
{ 
} 
 
 
BEGIN_MESSAGE_MAP(CStaticEx, CStatic) 
	ON_WM_PAINT() 
END_MESSAGE_MAP() 
 
 
 
// CStaticEx 消息处理程序 
 
 
void CStaticEx::OnPaint() 
{ 
	CPaintDC dc(this); // device context for painting 
	// TODO: 在此处添加消息处理程序代码 
	// 不为绘图消息调用 CStatic::OnPaint() 
 
 // 取得位置 
 CRect client_rect; 
 GetClientRect(client_rect); 
 
 // 取得文本 
 CString szText; 
 GetWindowText(szText); 
 
 // 取得字体,并选入设备文件 
 CFont *pFont, *pOldFont; 
 pFont = GetFont(); 
 pOldFont = dc.SelectObject(pFont); 
 
 // 用透明背景填充设备文件 
 dc.SetBkMode(TRANSPARENT); 
 dc.SetTextColor(RGB(255,255,0)); 
 
 // 显示文字 
 dc.DrawText(szText, client_rect, 0); 
 
 // 清除字体 
 dc.SelectObject(pOldFont); 
 
 
}