vc自定义控件及类绑定

来源:互联网 发布:java策略模式应用场景 编辑:程序博客网 时间:2024/05/06 08:45

(1)   基于对话框,添加custom control

(2)   选择custom control,右键Class Wizard为控件添加控件类

(3)   选择base classCDialogCWnd),定义类名,如COpenGLControl

(4)   注册自定义控件窗口类,并在构造函数中调用注册函数。

 

(5)   添加控件变量并绑定控件窗口。如:

 

CKWOpenGL1Dlg.h文件中:COpenGLControl m_opengl;

CKWOpenGL1Dlg.cppDoDataExchange中:DDX_Control(pDX,IDC_CUSTOM1,m_ opengl);

(6)   确定Class,如#define MYWNDCLASS "MyDrawPad",并修改Custom control属性的class

(7)   不要忘记#include " COpenGLControl.h"

参考:http://www.codeproject.com/KB/static/CustomControl.aspx

原创粉丝点击