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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. calling OnDraw()

calling OnDraw()

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    susanne1
    wrote on last edited by
    #1

    Hallo, i have the following code: void CTest_MyDocumentDoc::Print_Output() { m_ptrOutput->Invalidate (true);// m_ptrOutput= (CRichEditView *) m_wndSplitter.GetPane(1,0); m_ptrOutput->UpdateWindow(); UpdateAllViews(NULL); } i have splitted SDI-appliction and i need to call OnDraw() indirectly to print / draw my results in the second part of my splitted sdi App., this code does not work , the OnDraw() does NOT be called ??

    S 1 Reply Last reply
    0
    • S susanne1

      Hallo, i have the following code: void CTest_MyDocumentDoc::Print_Output() { m_ptrOutput->Invalidate (true);// m_ptrOutput= (CRichEditView *) m_wndSplitter.GetPane(1,0); m_ptrOutput->UpdateWindow(); UpdateAllViews(NULL); } i have splitted SDI-appliction and i need to call OnDraw() indirectly to print / draw my results in the second part of my splitted sdi App., this code does not work , the OnDraw() does NOT be called ??

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      Don't do it that way. Put your code to draw the window in a separate method and call that method from both OnDraw and Print_Output, passing a suitable DC in both cases. So, if you call it "DrawView", OnDraw would call DrawView, as would Print_Output.

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      S 1 Reply Last reply
      0
      • S Stuart Dootson

        Don't do it that way. Put your code to draw the window in a separate method and call that method from both OnDraw and Print_Output, passing a suitable DC in both cases. So, if you call it "DrawView", OnDraw would call DrawView, as would Print_Output.

        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

        S Offline
        S Offline
        susanne1
        wrote on last edited by
        #3

        i tried to do it that way before, but i did not have any text drawen on the monitor, i am forced to do it that way, and how can i get a suitable DC ? please explain in code . thanks

        S 1 Reply Last reply
        0
        • S susanne1

          i tried to do it that way before, but i did not have any text drawen on the monitor, i am forced to do it that way, and how can i get a suitable DC ? please explain in code . thanks

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #4

          susanne1 wrote:

          a suitable DC

          OnDraw[^] gives you a screen DC CPrintDialog/CPrintDialogEx can be used to create printer DCs, if you aren't going to follow the standard MFC printing mechanisms. So in each case, you have a way of calling your 'draw' code with a suitable DC.

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

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