一个模仿windows中的桌面背景预览的控件

翻译|其它|编辑:郝浩|2004-07-09 16:33:00.000|阅读 1690 次

概述:

# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>

这个控件是模仿微软windows操作系统中的显示属性对话框的控件。我作的这个custom控件具有和微软控件一样的功能。

这个控件通过在一个MFC标准Dll工程中的CMonitor类实现,CMonitor类继承于CWnd。当然这个类可以被扩展,直接加入到你的MFCexe工程中。你可以做一个基于对话框的程序,联机到dll工程,来看控件效果的演示。

我做了一个TestMonitor演示程序,你可以看到此控件的功能。

主要代码:

// SOURCE CODE HINTS

// a public static member function used for registering the
// control window class

static BOOL CMonitor::RegisterWndClass(HINSTANCE hInstance);

// a global function defined and used for transparently
// displaying the monitor

extern "C" __declspec(dllexport)
BOOL MaskImage(HDC hDC, int nXDest, int nYDest, int nWidth,
int nHeight, HBITMAP hbmImage, int nXSrc,
int nYSrc, HBITMAP hbmMask);

// the global control window procedure function

LRESULT CALLBACK AFX_EXPORT
CMonitorWndProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam);

// a set of user defined Windows control messages to
// communicate with the control

#define MM_SETIMAGE WM_USER + 0
#define MM_GETIMAGE WM_USER + 1
#define MM_SETDISPLAYSTYLE WM_USER + 2
#define MM_GETDISPLAYSTYLE WM_USER + 3
#define MM_SETREF WM_USER + 4
#define MM_GETREF WM_USER + 5

// a dummy function is used to be called from the client program
// to ensure the dll loading

extern "C" __declspec(dllexport)
void MonitorDllEntry() {} // dummy function

标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com


为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP