头文件:#if !defined(AFX_SUYISTATIC_H__430356B9_E7E3_44F9_A665_A5664A287661__INCLUDED_)
#define AFX_SUYISTATIC_H__430356B9_E7E3_44F9_A665_A5664A287661__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SuYiStatic.h : header file
///////////////////////////////////////////////////////////////////////////////
// CSuYiStatic windowclass CSuYiStatic : public CStatic
{
// Construction
public:
CSuYiStatic();// Attributes
public:// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSuYiStatic)
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CSuYiStatic(); // Generated message map functions
protected:
//{{AFX_MSG(CSuYiStatic)
// NOTE - the ClassWizard will add and remove member functions here.
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor); //}}AFX_MSG DECLARE_MESSAGE_MAP()
};///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_SUYISTATIC_H__430356B9_E7E3_44F9_A665_A5664A287661__INCLUDED_)CPP文件:
/ SuYiStatic.cpp : implementation file
//#include "stdafx.h"
#include "SuYiStatic.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CSuYiStaticCSuYiStatic::CSuYiStatic()
{
}CSuYiStatic::~CSuYiStatic()
{
}
BEGIN_MESSAGE_MAP(CSuYiStatic, CStatic)
//{{AFX_MSG_MAP(CSuYiStatic)
// NOTE - the ClassWizard will add and remove mapping macros here.
ON_WM_CTLCOLOR_REFLECT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CSuYiStatic message handlers
HBRUSH CSuYiStatic::CtlColor(CDC* pDC, UINT nCtlColor)
{
ASSERT(nCtlColor == CTLCOLOR_STATIC);
pDC->SetTextColor(RGB(0,100,100)); // transparent text.
pDC->SetBkMode(TRANSPARENT);
return (HBRUSH)GetStockObject(NULL_BRUSH);
}
#define AFX_SUYISTATIC_H__430356B9_E7E3_44F9_A665_A5664A287661__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SuYiStatic.h : header file
///////////////////////////////////////////////////////////////////////////////
// CSuYiStatic windowclass CSuYiStatic : public CStatic
{
// Construction
public:
CSuYiStatic();// Attributes
public:// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSuYiStatic)
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CSuYiStatic(); // Generated message map functions
protected:
//{{AFX_MSG(CSuYiStatic)
// NOTE - the ClassWizard will add and remove member functions here.
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor); //}}AFX_MSG DECLARE_MESSAGE_MAP()
};///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_SUYISTATIC_H__430356B9_E7E3_44F9_A665_A5664A287661__INCLUDED_)CPP文件:
/ SuYiStatic.cpp : implementation file
//#include "stdafx.h"
#include "SuYiStatic.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CSuYiStaticCSuYiStatic::CSuYiStatic()
{
}CSuYiStatic::~CSuYiStatic()
{
}
BEGIN_MESSAGE_MAP(CSuYiStatic, CStatic)
//{{AFX_MSG_MAP(CSuYiStatic)
// NOTE - the ClassWizard will add and remove mapping macros here.
ON_WM_CTLCOLOR_REFLECT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CSuYiStatic message handlers
HBRUSH CSuYiStatic::CtlColor(CDC* pDC, UINT nCtlColor)
{
ASSERT(nCtlColor == CTLCOLOR_STATIC);
pDC->SetTextColor(RGB(0,100,100)); // transparent text.
pDC->SetBkMode(TRANSPARENT);
return (HBRUSH)GetStockObject(NULL_BRUSH);
}
解决方案 »
- 用VC设计扫雷游戏问题?
- VC单文档环境下如何实现数据采集的实时显示
- unexpected end of file while looking for precompiled header directive是什么错误?
- new关键字的使用问题
- 序列化读入一个文件时,如何判断文件读完?
- include<adoint.h>和ipmort msado15.h的区别
- 如何使用onreadystatechange Event
- 关于SqlServer2000代理服务器问题,希望对网络编程和SQLSERVER连接有经验的高手看看!
- 在Opengl的投影方式下,如何知道窗口的边界的数值
- 编译问题,求助。
- 在MFC中如何结束UI线程?
- 老大们,偶被难住了,BOSS让我做的好难,快来帮一下忙,分全给了。谢谢了,快来,谢了!
我是说我知道怎样让一个STATIC透明,只是不知道它自带的TRANSPARENT属性有何用处?设了后在编辑模式下是透明,但一运行就不透明了。