控件OnPaint,导致主窗口的对话框弹出时无法显示

来源:互联网 发布:智巢网络 编辑:程序博客网 时间:2024/05/19 05:39

在编写一个控件时,需要重载OnPaint,结果导致主窗口的消息窗口弹出时,显示不出来。




class MyOpenGL :public CWnd{public:MyOpenGL(void);~MyOpenGL(void);DECLARE_MESSAGE_MAP()public:afx_msg void OnPaint();//重载了OnPaintafx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);};




一开始把CWnd::OnPaint()函数去掉,导致主窗口无法显示消息的弹出框。
添加CWnd::OnPaint() 可正常显示了。具体原因没有详细研究。


#include "StdAfx.h"#include "MyOpenGL.h"#include "resource.h"MyOpenGL::MyOpenGL(void){}MyOpenGL::~MyOpenGL(void){}BEGIN_MESSAGE_MAP(MyOpenGL, CWnd)ON_WM_CREATE()ON_WM_PAINT()END_MESSAGE_MAP()int MyOpenGL::OnCreate(LPCREATESTRUCT lpCreateStruct){if (CWnd::OnCreate(lpCreateStruct) == -1)return -1;return 0;}void MyOpenGL::OnPaint(){//CWnd::OnPaint(); //一开始把CWnd::OnPaint()函数去掉,导致主窗口无法显示消息的弹出框。}



阅读全文
0 0