dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Controlling button colours

  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,573

    Controlling button colours

    By intercepting WM_CTLCOLOR I can change certain aspects of how a control (in this case, a button) will look. For example, I can change its text colour and background (button face) colour.

    But suppose I want to change some of the other aspects of a button - for example the colour of the focus rectangle, or the button's shadow, or its bezel colour. Where is a good place to do this?
    "A problem well stated is a problem half solved. - Charles F. Kettering

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,562

    Re: Controlling button colours

    The only way I know of is using owner draw button.
    Victor Nijegorodov

  3. #3
    Join Date
    Jun 2000
    Posts
    184

    Re: Controlling button colours

    If you don't want to use owner draw and redraw all the component of the button, a simple solution is to use CImageButton and use different image for the state of the button

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,562

    Re: Controlling button colours

    Quote Originally Posted by indiana_pippis
    If you don't want to use owner draw and redraw all the component of the button, a simple solution is to use CImageButton ...
    And what is CImageButton?
    I couldn't find such a class in MSDN.

    Did you. probably, mean the CImageButton class from J.Newcomer essay A Better Bitmap Button Class? Well, it is a very good example of using owner draw button!
    Victor Nijegorodov

  5. #5
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,573

    Re: Controlling button colours

    Indiana probably meant CBitmapButton. It looks like owner draw is probably the best way to go though.
    "A problem well stated is a problem half solved. - Charles F. Kettering

  6. #6
    Join Date
    Jun 2000
    Posts
    184

    Re: Controlling button colours

    yes, CBitmapButton...

  7. #7
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,562

    Re: Controlling button colours

    Quote Originally Posted by indiana_pippis
    yes, CBitmapButton...
    Then read the essay I referred to...
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)