I'm blitting som lines onto a static text or picture control.
It works fine until I shrink the window so that the scrollbars appear.
If the window is smaller than the picture control I get gray areas instead of white in the right and bottom areas of the picture control.
Is this a known bug or am I doing something wrong? I've been trying to call OnPaint wherever I can but it doesn't solve the problem.
Drawing code (OnPaint)
CWnd* wnd = GetDlgItem(IDC_GRAFVIEWER);
CBitmap bmp;
CBitmap *oBmp=&bmp;
CRect rect, temp;
wnd->GetWindowRect(rect);
wnd->GetClientRect(temp);
ScreenToClient(rect);
CDC *pDC, mDC;
pDC = GetDC();
mDC.CreateCompatibleDC(pDC);
bmp.CreateCompatibleBitmap(pDC, temp.right, temp.bottom);
oBmp = mDC.SelectObject(&bmp);
mDC.FillRect(temp, &CBrush(0xFFFFFF));
p->DrawPic(mDC); // Consists of drawing some lines
pDC->BitBlt(rect.left, rect.top, rect.right , rect.bottom, &mDC, 0, 0, SRCCOPY);
mDC.SelectObject(oBmp);
wnd->RedrawWindow();
ReleaseDC(pDC);
ReleaseDC(&mDC);
It works fine until I shrink the window so that the scrollbars appear.
If the window is smaller than the picture control I get gray areas instead of white in the right and bottom areas of the picture control.
Is this a known bug or am I doing something wrong? I've been trying to call OnPaint wherever I can but it doesn't solve the problem.
Drawing code (OnPaint)
CWnd* wnd = GetDlgItem(IDC_GRAFVIEWER);
CBitmap bmp;
CBitmap *oBmp=&bmp;
CRect rect, temp;
wnd->GetWindowRect(rect);
wnd->GetClientRect(temp);
ScreenToClient(rect);
CDC *pDC, mDC;
pDC = GetDC();
mDC.CreateCompatibleDC(pDC);
bmp.CreateCompatibleBitmap(pDC, temp.right, temp.bottom);
oBmp = mDC.SelectObject(&bmp);
mDC.FillRect(temp, &CBrush(0xFFFFFF));
p->DrawPic(mDC); // Consists of drawing some lines
pDC->BitBlt(rect.left, rect.top, rect.right , rect.bottom, &mDC, 0, 0, SRCCOPY);
mDC.SelectObject(oBmp);
wnd->RedrawWindow();
ReleaseDC(pDC);
ReleaseDC(&mDC);