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. when does OnDraw Func. gets Called

when does OnDraw Func. gets Called

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
3 Posts 3 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.
  • A Offline
    A Offline
    Anamika2005
    wrote on last edited by
    #1

    In the mfc application when does the Ondraw handler gets called? what is the significance of that? Regards Shikha

    _ 1 Reply Last reply
    0
    • A Anamika2005

      In the mfc application when does the Ondraw handler gets called? what is the significance of that? Regards Shikha

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      if you are referring to CView this is what I read from the docs : Called by the framework to render an image of the document. The framework calls this function to perform screen display, printing, and print preview, and it passes a different device context in each case. There is no default implementation. You must override this function to display your view of the document. You can make graphic device interface (GDI) calls using the CDC object pointed to by the pDC parameter. You can select GDI resources, such as pens or fonts, into the device context before drawing and then deselect them afterwards. Often your drawing code can be device-independent; that is, it doesn’t require information about what type of device is displaying the image. Somethings seem HARD to do, until we know how to do them. ;-) _AnShUmAn_

      Steve EcholsS 1 Reply Last reply
      0
      • _ _AnsHUMAN_

        if you are referring to CView this is what I read from the docs : Called by the framework to render an image of the document. The framework calls this function to perform screen display, printing, and print preview, and it passes a different device context in each case. There is no default implementation. You must override this function to display your view of the document. You can make graphic device interface (GDI) calls using the CDC object pointed to by the pDC parameter. You can select GDI resources, such as pens or fonts, into the device context before drawing and then deselect them afterwards. Often your drawing code can be device-independent; that is, it doesn’t require information about what type of device is displaying the image. Somethings seem HARD to do, until we know how to do them. ;-) _AnShUmAn_

        Steve EcholsS Offline
        Steve EcholsS Offline
        Steve Echols
        wrote on last edited by
        #3

        Also, you might lookup WM_PAINT in the docs. Your window will get redrawn in a number of circumstances, some that you might not be expecting, such as when you drag another window over your window, you will get numerous WM_PAINT (OnDraw) events. Not sure why you need to know "when" it gets called, just be prepared to handle OnDraw at any time, because you never know when it will be called. Or maybe you're wondering about the order events are fired...can't help you with that one...


        - S 50 cups of coffee and you know it's on!

        • S
          50 cups of coffee and you know it's on!
          Code, follow, or get out of the way.
        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