Click here to Skip to main content
15,898,035 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Nice discussion point ? Pin
toxcct15-Jun-04 3:30
toxcct15-Jun-04 3:30 
GeneralRe: Nice discussion point ? Pin
Nitron15-Jun-04 6:30
Nitron15-Jun-04 6:30 
GeneralRe: Nice discussion point ? Pin
David Crow15-Jun-04 5:07
David Crow15-Jun-04 5:07 
GeneralRe: Nice discussion point ? Pin
bikram singh15-Jun-04 11:57
bikram singh15-Jun-04 11:57 
AnswerRe: Nice discussion point ? Pin
Tim Smith15-Jun-04 3:52
Tim Smith15-Jun-04 3:52 
GeneralMsFlexGrid and CDialogBar Pin
Anonymous14-Jun-04 22:56
Anonymous14-Jun-04 22:56 
GeneralGetting (x,y) Coords of MSChart Pin
Member 97062114-Jun-04 22:37
Member 97062114-Jun-04 22:37 
GeneralScroll view & Print preview Pin
Nelson L.14-Jun-04 22:05
Nelson L.14-Jun-04 22:05 
Hi, I am a newbie using MFC. Most program scripts were copied from either books and examples.

I encounter a difficulty when I wanna to scroll view and print preview.

//======================
void CSLReaderView::OnDraw(CDC* pDC)
{
CSLReaderDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here

//change the mapping mode
pDC->SetMapMode(MM_LOENGLISH);

//plot a rectanglar first, height 400 pixels, not shown in the script

// display data here
pDC->TextOut(100, -500, "RECORDING REPORT");
for (i=0; i<n; i++)
="" {
="" sprintf(s,="" "%3d",="" pdoc-="">m_SLDA[i].LAi);
pDC->TextOut(100, -540-i*20, s);
}

CSize docSize(100, 400+(N+10)*20); //doc size
CRect rect; //cal page size
GetClientRect(&rect);
CSize pageSize(rect.right, rect.bottom);
CSize lineSize(0, 20); //line size
SetScrollSizes(MM_LOENGLISH, docSize, pageSize, lineSize);
}

void CSLReaderView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
sizeTotal.cx = sizeTotal.cy = 100;
SetScrollSizes(MM_TEXT, sizeTotal);
}

void CSLReaderView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
CSLReaderDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
int pageHeight = pDC->GetDeviceCaps(VERTRES); //page height (dots)
int logPixelsY = pDC->GetDeviceCaps(LOGPIXELSY); //dots/inch for pt int plotHeight = (int) (4.0*logPixelsY); //rectan->pixels for pt
int lineHeight = (int) (0.2*logPixelsY); //line hight->pixels for pt int numPages = (pDoc->m_SLDA.GetSize()*lineHeight + plotHeight) / pageHeight + 1;
pInfo ->SetMaxPage(numPages);
}

void CSLReaderView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo)
{
if (pDC->IsPrinting())
{
int pageHeight = pDC->GetDeviceCaps(VERTRES);
int OriginY = pageHeight * (pInfo->m_nCurPage-1);
pDC->SetViewportOrg(0, -OriginY);
}

//CScrollView::OnPrepareDC(pDC, pInfo); //CONFLICT 1: if so, print preview can not show the 2nd page

//CView::OnPrepareDC(pDC, pInfo); //CONFLICT 2: if so, view can not scroll
}

The conflict comes from the last two commands OnPrepareDC(), if use only the first, print preview can not show the 2nd page, i.e. all pages are the same. if use only the second, the view can not be scrolled properly in view.

Thanks for your time. The code is long but I have no other ways to describe it better.

Regards,

NelsonConfused | :confused:
GeneralDrawCli Pin
Arun AC14-Jun-04 21:01
Arun AC14-Jun-04 21:01 
QuestionHow to stream (send) a Video on a Network Pin
Zeeshan Bilal14-Jun-04 20:12
Zeeshan Bilal14-Jun-04 20:12 
AnswerRe: How to stream (send) a Video on a Network Pin
Vadim Tabakman14-Jun-04 20:36
Vadim Tabakman14-Jun-04 20:36 
GeneralRe: How to stream (send) a Video on a Network Pin
Zeeshan Bilal14-Jun-04 21:53
Zeeshan Bilal14-Jun-04 21:53 
AnswerRe: How to stream (send) a Video on a Network Pin
Un121-Aug-04 5:55
Un121-Aug-04 5:55 
GeneralWin CE DialogBar Pin
S.DARWIN PAUL RAJ14-Jun-04 20:06
S.DARWIN PAUL RAJ14-Jun-04 20:06 
GeneralScrolling in windows Pin
Member 80176914-Jun-04 20:06
Member 80176914-Jun-04 20:06 
GeneralRe: Scrolling in windows Pin
Vadim Tabakman14-Jun-04 20:35
Vadim Tabakman14-Jun-04 20:35 
QuestionHelp in tabbed dialogs?? Pin
Lakshmi Priya Musuvathy14-Jun-04 20:02
Lakshmi Priya Musuvathy14-Jun-04 20:02 
AnswerRe: Help in tabbed dialogs?? Pin
David Crow15-Jun-04 2:34
David Crow15-Jun-04 2:34 
Generaldifference b/w C and C++ Pin
saurabh190514-Jun-04 19:32
saurabh190514-Jun-04 19:32 
GeneralRe: difference b/w C and C++ Pin
Vadim Tabakman14-Jun-04 19:39
Vadim Tabakman14-Jun-04 19:39 
GeneralRe: difference b/w C and C++ Pin
Maxwell Chen14-Jun-04 20:04
Maxwell Chen14-Jun-04 20:04 
GeneralRe: difference b/w C and C++ Pin
V.14-Jun-04 21:54
professionalV.14-Jun-04 21:54 
GeneralRe: difference b/w C and C++ Pin
David Crow15-Jun-04 2:40
David Crow15-Jun-04 2:40 
GeneralRe: difference b/w C and C++ Pin
Henry miller15-Jun-04 4:13
Henry miller15-Jun-04 4:13 
GeneralRe: difference b/w C and C++ Pin
Johnny ²15-Jun-04 4:43
Johnny ²15-Jun-04 4:43 

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.