I am having a problem with the BitMapViewer tutorial from: http://sunlightd.virtualave.net/Windows/GUI/
If you take a look at my screen shot, you’ll see that the bmp I load into my static group box IDC_VIEW isn’t staying within its border it runs on through to the edge of the window.
Looking at the following code I see how it finds the top and left coords but how does it know where the lower left of the view is supposed to be?
Code:
void MainDialog_OnPaint(HWND hWnd, HDC hDC)
{
if (hBitmap == NULL)
return;
RECT r;
POINT p;
GetClientRect(GetDlgItem(hWnd, IDC_VIEW), &r);
p.x = r.left;
p.y = r.top;
ClientToScreen(GetDlgItem(hWnd, IDC_VIEW), &p);
ScreenToClient(hWnd, &p);
DrawState(hDC, NULL, NULL, (LPARAM)hBitmap, 0, p.x, p.y, 0, 0, DST_BITMAP | DSS_NORMAL);
}