Here's a very simple implementation that simulates drawing a page. First, create an SDI project that uses CScrollview as its view class. Make the following changes to the myview.cpp file. 1) Add two constants to the top of the file: // Origin for the top/left of the paper CPoint g_ptOrigin(50,50); // Paper dimensions (simulates a 8.5 x 11" page) CRect g_rcPaper(0, 0, 850, 1100); 2) In the OnDraw function, insert the following code: pDC->SetBkMode(TRANSPARENT); pDC->Rectangle(g_rcPaper); pDC->TextOut(50, 50, _T("This is a test")); 3) Create an override for OnPrepareDC, and insert the following code after the call to the base class: // Map the logical origin to the device origin // This makes the top left of the client area act like (-50,-50), and the top/left of the page act like (0,0) pDC->OffsetWindowOrg(-g_ptOrigin.x, -g_ptOrigin.y); 4) Add a handler for the ON_WM_ERASEBKGND message and replace with the following code: CRect rcClient; GetClientRect(rcClient); pDC->FillSolidRect(rcClient, RGB(127,127,127)); return (TRUE); - Step 4 draws your gray background - Step 3 offsets the dc origin so that drawing is relative to the top left of the paper, not the top left of the client area - Step 2 draws the paper, with the offset in place
:suss: Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
Painted on the side of a dog trainer's van: SIT HAPPENS