odin
April 17th, 1999, 05:40 AM
Hello,
I'm doing some NC area painting in the WM_PAINT() procedure. The thing is that the painting doesn't always seem to work. But it always work if I put a AfxMessageBox() call in the beginning, I guess this changes the focus of the window somehow so the painting works, but I don't know how. Any ideas?
I'm processing the WM_PAINT in the CMainFrame and I got a splitter window in the main CView.
This is some of my code:
void CMainFrame::OnPaint()
{
CFrameWnd::OnPaint();
AfxMessageBox("now itll work but with a annoying msgbox");
CWindowDC dc(this);
CView* pView = GetRightPane();
CPen penGrey, penWhite, penDark;
RECT rectTmp;
pView->GetWindowRect(&rectTmp);
penGrey.CreatePen(PS_SOLID, 2, ::GetSysColor(COLOR_ACTIVEBORDER));
penWhite.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_BTNHILIGHT));
penDark.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_BTNSHADOW));
RECT rect;
GetWindowRect(&rect);
ScreenToClient(&rect);
CPen* penOld = dc.SelectObject(&penGrey);
// sidlinjer grå
dc.MoveTo(rect.left + 9, rect.top + 115);
dc.LineTo(rect.left + 9, rect.bottom + 18);
dc.MoveTo(rect.right, rect.top + 115);
dc.LineTo(rect.right, rect.bottom + 18);
.
.
.
}
-- HENRIK
I'm doing some NC area painting in the WM_PAINT() procedure. The thing is that the painting doesn't always seem to work. But it always work if I put a AfxMessageBox() call in the beginning, I guess this changes the focus of the window somehow so the painting works, but I don't know how. Any ideas?
I'm processing the WM_PAINT in the CMainFrame and I got a splitter window in the main CView.
This is some of my code:
void CMainFrame::OnPaint()
{
CFrameWnd::OnPaint();
AfxMessageBox("now itll work but with a annoying msgbox");
CWindowDC dc(this);
CView* pView = GetRightPane();
CPen penGrey, penWhite, penDark;
RECT rectTmp;
pView->GetWindowRect(&rectTmp);
penGrey.CreatePen(PS_SOLID, 2, ::GetSysColor(COLOR_ACTIVEBORDER));
penWhite.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_BTNHILIGHT));
penDark.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_BTNSHADOW));
RECT rect;
GetWindowRect(&rect);
ScreenToClient(&rect);
CPen* penOld = dc.SelectObject(&penGrey);
// sidlinjer grå
dc.MoveTo(rect.left + 9, rect.top + 115);
dc.LineTo(rect.left + 9, rect.bottom + 18);
dc.MoveTo(rect.right, rect.top + 115);
dc.LineTo(rect.right, rect.bottom + 18);
.
.
.
}
-- HENRIK