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. Article Writing
  3. Superclassing

Superclassing

Scheduled Pinned Locked Moved Article Writing
2 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.
  • I Offline
    I Offline
    Ivan A Fotan
    wrote on last edited by
    #1

    How can I derive (superclass) my own class of windows from standard BUTTON class, for example, and change its look (for example: buttons and other controls in Microsoft Money).

    A 1 Reply Last reply
    0
    • I Ivan A Fotan

      How can I derive (superclass) my own class of windows from standard BUTTON class, for example, and change its look (for example: buttons and other controls in Microsoft Money).

      A Offline
      A Offline
      Andrei Zenkovitch
      wrote on last edited by
      #2

      Derive your class from CButton. Then you have to guarantee that your button is always created using BS_OWNERDRAW style (if button is created explicitely using Create() function you might override PreCreateWindow() in order to do that, otherwise when button is being subclassed, e.g. in DDX/DDV engine, you have to override PreSubclassWindow() and put there an assert that checks for BS_OWNERDRAW style). As long as BS_OWNERDRAW style is set Windows will send your button WM_DRAWITEM message in which you have to draw the button. MFC provides virtual DrawItem() function that you need to override in order to handle WM_DRAWITEM message. From this point you are on your own in terms of providing drawinf implementation and handling the mouse and keyboard input in any specific way (of course, if you need to). Above mentioned details of implementation are valid only if you use MFC in your development. Using straight SDK you would need to take basically the same steps. But of course you need to handle all corresponding messages (WM_CREATE, WM_DRAWITEM) explicitly in your window procedure. Regards Andrei Zenkovitch Dundas Software ================== The original message was: How can I derive (superclass) my own class of windows from standard BUTTON class, for example, and change its look (for example: buttons and other controls in Microsoft Money).

      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