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. One DrawItem Function for both CStatic and CComboBox

One DrawItem Function for both CStatic and CComboBox

Scheduled Pinned Locked Moved C / C++ / MFC
5 Posts 2 Posters 4 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.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Hi is there a way to have one DrawItem Function if you have both a derived CStatic and CComboBox a function pointer to the drawitem function. The Function itself takes into consideration both a static and combbox. Not sure because the complier looks to see if you decalred a Drawitem for either a static or combobox

    L 1 Reply Last reply
    0
    • F ForNow

      Hi is there a way to have one DrawItem Function if you have both a derived CStatic and CComboBox a function pointer to the drawitem function. The Function itself takes into consideration both a static and combbox. Not sure because the complier looks to see if you decalred a Drawitem for either a static or combobox

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      There is quite a difference between the two classes so it would not be easy. You could provide a DrawItem method for each which then calls out to a helper function to do the actual work.

      F 1 Reply Last reply
      0
      • L Lost User

        There is quite a difference between the two classes so it would not be easy. You could provide a DrawItem method for each which then calls out to a helper function to do the actual work.

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #3

        That’s is not a bad idea Richard this may not be conventional but I think I’ll make the code part of DLL I have and pass the drawitemstruct

        L 1 Reply Last reply
        0
        • F ForNow

          That’s is not a bad idea Richard this may not be conventional but I think I’ll make the code part of DLL I have and pass the drawitemstruct

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          I have done vaguely similar things in the past, although not with these specific controls. And it should work the same whether it is part of the application or the DLL. The only requirement should be (I hope) that the code can distinguish if necessary between the two controls.

          F 1 Reply Last reply
          0
          • L Lost User

            I have done vaguely similar things in the past, although not with these specific controls. And it should work the same whether it is part of the application or the DLL. The only requirement should be (I hope) that the code can distinguish if necessary between the two controls.

            F Offline
            F Offline
            ForNow
            wrote on last edited by
            #5

            The ctltype will help yo distinguish thanks

            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