_11D2_AC8F_0060084237F6__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ShadowWnd.h : header file
/////////////////////////////////////////////////////////////////////////////
// CShadowWnd window
class CShadowWnd : public CWnd
{
//Construction
public:
CShadowWnd();
//Attributes
public:
//Operations
public:
//Overrides
//ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CShadowWnd)
public:
virtual BOOL Create(const RECT& rect, CWnd* pParentWnd);
//}}AFX_VIRTUAL
//Implementation
public:
CString m_sShowText;
void ShowReadOnlyText(CString sText);
CBrush m_bmpBrush;
virtual ~CShadowWnd();
//Generated message map functions
protected:
//{{AFX_MSG(CShadowWnd)
afx_msg void OnNcPaint();
afx_msg void OnPaint();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
///////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
//Microsoft Developer Studio will insert additional declarations immediately
efore the previous line.
#endif
/ !defined(AFX_SHADOWWND_H__B971A958_59CC_11D2_AC8F_0060084237F6__INCLUDED_)
//实现文件
}
// ShadowWnd.cpp : implementation file
//
#include "stdafx.h"
#include "Shadow.h"
#include "ShadowWnd.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE = __FILE__;
#endif
//定义常数
static int aPattern={0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55};//阴影位图数组
#define SPOPUP_SHADOWWIDTH 10 //阴影宽度
#define SPOPUP_SHADOWHEIGHT 13 //阴影高度
#define MAXWIDTH 400 //显示字符矩形的最大宽度
/////////////////////////////////////////////////////////////////////////////
// CshadowWnd
CShadowWnd::CShadowWnd()
{
CBitmap bmp;
bmp.CreateBitmap(8,8,1,1,(void* )aPattern);//创建一个阴影位图
m_bmpBrush.CreatePatternBrush(&bmp); //创建一把阴影刷
}
CShadowWnd::~CShadowWnd()
{
}
BEGIN_MESSAGE_MAP(CShadowWnd, CWnd)
//{{AFX_MSG_MAP(CShadowWnd)
ON_WM_NCPAINT()
ON_WM_PAINT()
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CShadowWnd message handlers
BOOL CShadowWnd::Create(const RECT& rect, CWnd* pParentWnd)
{
// TODO: Add your specialized code here and/or call the base class
const char* pClassName=AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW);
return CWnd::CreateEx(WS_EX_STATICEDGE,pClassName, "Shadow window", WS_POPUP,
rect.left,rect.top,rect.right,rect.bottom, pParentWnd->GetSafeHwnd(),0,NULL);
}
void CShadowWnd::OnNcPaint()
{
// TODO: Add your message handler code here
CWindowDC dc(this);
CRect rc;
GetWindo