Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
N

Nelson L

@Nelson L
About
Posts
4
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Any idea on this simple application?
    N Nelson L

    I have a data file which was written in a text ascii format, I would like to generate a report, describe the filename, date, etc, also extract some data and presented them in a curve, the data should also be listed in a table. I was used doc/view to realize it, but it looks not very fancy, especially I have to draw the table line by line. Any good idea? Thanks. Nelson L.

    C / C++ / MFC question

  • a newbie question
    N Nelson L

    Hi, I would like to update the display in the CSTestView if the OK botton on CParaDlg is pressed, how to initiate the update? void CParaDlg::OnOK() { CString msg = "checked"; AfxMessageBox(msg); CDialog::OnOK(); } void CSTestView::OnDraw() { } I will be very appreciated for whatever hint I received. Regards Nelson L.

    C / C++ / MFC question tutorial announcement

  • scroll the document?
    N Nelson L

    Hi, I made a small project and draw a graph and write a few lines on the display using CScrollView, the scrollbar works when the text exceed the windows. To work on the print preview, after adding the following, the print preview looks ok, but the display fails even when I move the thumb scroll bar. void CReaderView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) { if (pDC->IsPrinting()) { int pageHeight = pDC->GetDeviceCaps(VERTRES); int OriginY = pageHeight * (pInfo->m_nCurPage-1); pDC->SetViewportOrg(0, -OriginY); } CView::OnPrepareDC(pDC, pInfo); } I tried to add a WM_VSCROLL, and change the ViewportOrg, seems not working. I also found if I replace the last line with CScrollView::OnPrepareDC(pDC, pInfo); the effect is reversed. Anyone could give me some hints on this? Thanks.

    C / C++ / MFC data-structures question

  • Scroll view & Print preview
    N Nelson L

    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; im_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, Nelson:confused:

    C / C++ / MFC c++ tools
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups