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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Focus Rect on a CButton

Focus Rect on a CButton

Scheduled Pinned Locked Moved C / C++ / MFC
comgraphics
3 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.
  • R Offline
    R Offline
    Remi Morin
    wrote on last edited by
    #1

    Hi, I've create a very little bitmap button (that class is derived from CButton) and I don't want it draw a focus rect. In fact the focus Rect is draw over the bitmap and my button is so small that we are unable to understand it so if you find a way to remove it, tell me please thanks Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

    D 1 Reply Last reply
    0
    • R Remi Morin

      Hi, I've create a very little bitmap button (that class is derived from CButton) and I don't want it draw a focus rect. In fact the focus Rect is draw over the bitmap and my button is so small that we are unable to understand it so if you find a way to remove it, tell me please thanks Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

      D Offline
      D Offline
      Derek Lakin
      wrote on last edited by
      #2

      You need to override the DrawItem function to handle your own drawing. There are many owner-drawn buttons that have bitmap support here already, e.g. CButtonSSL, which I wrote ;) It would only take a few small changes to prevent the focus rectangle being drawn (just comment out the call to DrawFocusRect). Derek Lakin. Salamander Software Ltd.

      R 1 Reply Last reply
      0
      • D Derek Lakin

        You need to override the DrawItem function to handle your own drawing. There are many owner-drawn buttons that have bitmap support here already, e.g. CButtonSSL, which I wrote ;) It would only take a few small changes to prevent the focus rectangle being drawn (just comment out the call to DrawFocusRect). Derek Lakin. Salamander Software Ltd.

        R Offline
        R Offline
        Remi Morin
        wrote on last edited by
        #3

        Hi thanks for the tips but it's a big implementation for something so simple. I did'nt find what I'm searching for but I will. This is for a commercial application, in fact a application that we sold whit hardware, but this application will need modification/update very often, the reason why I'm doing it now (and i'm not using the old one) it's because modification/update are too hard. So I want to minimize the code. I'm doing a scroll bar derived from CWnd to get strange functionality, and I'm doing the little arrow at each end of my scroll bar. For these button, I don't want any Focus rect, everything else work already very well whitout so much code. So I don't want add a big button class when CButton do already the job very well, except for that f*** focus rect. Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com

        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