Hello! :)
I have a CMDIChildWnd (CStatusFrame) with a richedit on it. I am resizing the richedit when CStatusFrame is resized. Originally it was..
// Code from CStatusFrame PreCreateWindow:
cs.style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_TABSTOP;
cs.lpszClass = AfxRegisterWndClass(CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,
NULL, (HBRUSH) (COLOR_WINDOW), NULL);
// Function for resizing richedit:
void CStatusFrame::OnSize(UINT nType, int cx, int cy) {
if (::IsWindow(m_RichEd.GetSafeHwnd())) {
m_RichEd.MoveWindow(0, 1, cx - 1, cy - 21);
}
return;
}
Worked OK. No flickering when I drag to resize. Then I noticed a problem - when I maximized the window, the maximize, minimize and close buttons did not appear on the menu frame and the windows caption was not appended to the programs. So I read that I should change the Onsize to..
void CStatusFrame::OnSize(UINT nType, int cx, int cy) {
if (::IsWindow(this->m_hWnd)) {
// Insert evil flicker.
CMDIChildWnd::OnSize(nType, cx, cy);
m_RichEd.MoveWindow(0, 1, cx - 1, cy - 21);
}
return;
}
Now the menu/caption showed up properly, but the richedit is flickering loads when I resize it. I've tried some work arounds from different suggestions I've read (Invalidate, map OnEraseBkgnd + return false) but they either didn't work, or I used them incorrectly.
I'm wondering if either I can simulate the action of showing the menu/caption without calling CMDIChildWnd::OnSize, or else, what exactly is happening here to cause the new flickering and how might I fix it?
Thanks!
(And can I just add - these forums are incredibly nice looking :o )