现在的位置: 首页 > 综合 > 正文

vc自定义控件及类绑定

2013年10月04日 ⁄ 综合 ⁄ 共 1206字 ⁄ 字号 评论关闭

(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

抱歉!评论已关闭.