Hello,
I have a CWnd class, that is a child to another CWnd. The problem is that onPaint() is never invoked. Even when I call UpdateTest(), and the Invalidate() gets called, OnPaint() still does not get called. If I explicitly call OnPain() instead of Invalidate() it works. Anyone know what my problem is?
I have a CWnd class, that is a child to another CWnd. The problem is that onPaint() is never invoked. Even when I call UpdateTest(), and the Invalidate() gets called, OnPaint() still does not get called. If I explicitly call OnPain() instead of Invalidate() it works. Anyone know what my problem is?
Code:
my Test.h file:
#pragma once
class Test : public CWnd
{
public:
Test() {};
virtual ~Test() {};
void CreateWindow(CWnd* parent, int x, int y);
private:
afx_msg void OnPaint();
DECLARE_MESSAGE_MAP()
};
and the cpp file:
#include "Test.h"
BEGIN_MESSAGE_MAP(Test, CWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()
void Test::CreateWindow(CWnd* parent, int x, int y)
{
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_BORDER;
CRect rect(x, y, x+50, y+50);
CWnd::Create(AfxRegisterWndClass(CS_DBLCLKS), L"", dwStyle, rect, parent, NULL, NULL);
}
void Test::OnPaint()
{
CPaintDC dc(this);
dc.TextOut(0, 0, "hello!");
}
void Test::UpdateTest()
{
....
Invalidate();
}