Click here to Skip to main content
15,922,584 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralNon-blocking reading of input Pin
Cedric Moonen4-Jul-05 2:25
Cedric Moonen4-Jul-05 2:25 
GeneralRe: Non-blocking reading of input Pin
M.Mehrdad.M4-Jul-05 6:12
M.Mehrdad.M4-Jul-05 6:12 
GeneralRe: Non-blocking reading of input Pin
badal_akr4-Jul-05 21:20
badal_akr4-Jul-05 21:20 
GeneralPrint-Layout View implementation Pin
Maverick4-Jul-05 2:08
Maverick4-Jul-05 2:08 
GeneralRe: Print-Layout View implementation Pin
Jack Puppy4-Jul-05 2:31
Jack Puppy4-Jul-05 2:31 
GeneralRe: Print-Layout View implementation Pin
Maverick4-Jul-05 15:49
Maverick4-Jul-05 15:49 
GeneralRe: Print-Layout View implementation Pin
Maverick5-Jul-05 3:05
Maverick5-Jul-05 3:05 
GeneralRe: Print-Layout View implementation Pin
Jack Puppy5-Jul-05 4:25
Jack Puppy5-Jul-05 4:25 
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:

<br />
// Origin for the top/left of the paper<br />
CPoint  g_ptOrigin(50,50);<br />
<br />
// Paper dimensions (simulates a 8.5 x 11" page)<br />
CRect   g_rcPaper(0, 0, 850, 1100);<br />


2) In the OnDraw function, insert the following code:
<br />
pDC->SetBkMode(TRANSPARENT);<br />
pDC->Rectangle(g_rcPaper);<br />
pDC->TextOut(50, 50, _T("This is a test"));<br />


3) Create an override for OnPrepareDC, and insert the following code after the call to the base class:

<br />
<br />
// Map the logical origin to the device origin<br />
// This makes the top left of the client area act like (-50,-50), and the top/left of the page act like (0,0)<br />
pDC->OffsetWindowOrg(-g_ptOrigin.x, -g_ptOrigin.y);<br />
<br />


4) Add a handler for the ON_WM_ERASEBKGND message and replace with the following code:

<br />
CRect rcClient;<br />
GetClientRect(rcClient);<br />
pDC->FillSolidRect(rcClient, RGB(127,127,127));<br />
return (TRUE);<br />


- 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






Suspicious | :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

GeneralLOGON Problem Pin
M.Mehrdad.M4-Jul-05 1:18
M.Mehrdad.M4-Jul-05 1:18 
GeneralRe: LOGON Problem Pin
2249174-Jul-05 1:36
2249174-Jul-05 1:36 
GeneralRe: LOGON Problem Pin
M.Mehrdad.M4-Jul-05 2:21
M.Mehrdad.M4-Jul-05 2:21 
GeneralRe: LOGON Problem Pin
2249174-Jul-05 4:53
2249174-Jul-05 4:53 
GeneralRe: LOGON Problem Pin
David Crow4-Jul-05 11:24
David Crow4-Jul-05 11:24 
GeneralNeed Help in Menus ( VC 6 ) Pin
m_amin834-Jul-05 1:15
m_amin834-Jul-05 1:15 
GeneralRe: Need Help in Menus ( VC 6 ) Pin
Jose Lamas Rios4-Jul-05 3:19
Jose Lamas Rios4-Jul-05 3:19 
Generalvs.net c++ to mysql4.1 Pin
__horus__4-Jul-05 0:24
__horus__4-Jul-05 0:24 
GeneralRe: vs.net c++ to mysql4.1 Pin
Bruno Miguel Ribeiro Fernandes4-Jul-05 1:19
Bruno Miguel Ribeiro Fernandes4-Jul-05 1:19 
General1KB/S problem Pin
a_du4-Jul-05 0:18
a_du4-Jul-05 0:18 
GeneralRemove LAN-Adapter Pin
chrisigo4-Jul-05 0:09
chrisigo4-Jul-05 0:09 
GeneralRe: Remove LAN-Adapter Pin
munawar19684-Jul-05 0:38
munawar19684-Jul-05 0:38 
GeneralRe: Remove LAN-Adapter Pin
chrisigo4-Jul-05 1:31
chrisigo4-Jul-05 1:31 
GeneralRe: Remove LAN-Adapter Pin
munawar19684-Jul-05 1:52
munawar19684-Jul-05 1:52 
GeneralRe: Remove LAN-Adapter Pin
chrisigo4-Jul-05 4:04
chrisigo4-Jul-05 4:04 
Generalcopying a dialog box Pin
Anonymous3-Jul-05 23:38
Anonymous3-Jul-05 23:38 
GeneralRe: copying a dialog box Pin
2249174-Jul-05 0:18
2249174-Jul-05 0:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.