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. OnPaint vr. DrawItem

OnPaint vr. DrawItem

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
4 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.
  • J Offline
    J Offline
    jason99
    wrote on last edited by
    #1

    Hi, I'm currently creating a lot of ownerdrawn MFC-controls. Can anybody tell why i should use DrawItem() instead of OnPaint()?

    C 1 Reply Last reply
    0
    • J jason99

      Hi, I'm currently creating a lot of ownerdrawn MFC-controls. Can anybody tell why i should use DrawItem() instead of OnPaint()?

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      for many controls, DrawItem will give you information about the specific sub-item (menu choice, list box item, etc) that you need to draw. OnPaint is for the control as a whole. for controls that don't have sub-items, there's not much difference between the two (buttons, etc) Cleek | Image Toolkits | Thumbnail maker

      PJ ArendsP 1 Reply Last reply
      0
      • C Chris Losinger

        for many controls, DrawItem will give you information about the specific sub-item (menu choice, list box item, etc) that you need to draw. OnPaint is for the control as a whole. for controls that don't have sub-items, there's not much difference between the two (buttons, etc) Cleek | Image Toolkits | Thumbnail maker

        PJ ArendsP Offline
        PJ ArendsP Offline
        PJ Arends
        wrote on last edited by
        #3

        Chris Losinger wrote:

        for controls that don't have sub-items, there's not much difference between the two (buttons, etc)

        For buttons, DrawItem provides provides a lot of info that OnPaint does not, such as selection and focus state, and whether the button is up, down, disabled, ect.


        "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!

        Within you lies the power for good; Use it!

        C 1 Reply Last reply
        0
        • PJ ArendsP PJ Arends

          Chris Losinger wrote:

          for controls that don't have sub-items, there's not much difference between the two (buttons, etc)

          For buttons, DrawItem provides provides a lot of info that OnPaint does not, such as selection and focus state, and whether the button is up, down, disabled, ect.


          "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!

          C Offline
          C Offline
          Chris Losinger
          wrote on last edited by
          #4

          ah yeah. forgot about that.. been a long time... Cleek | Image Toolkits | Thumbnail maker

          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