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

Thread: button color

  1. #1
    Join Date
    Oct 2004
    Posts
    38

    Question button color

    ok, I have seen a lot of threads about changing button color but.... (some using MFC, what confuses me...)

    I could not understand where I should put the notification...
    case WM_CTLCOLORDLG:
    and how to handle this.

    It it inside my DialogProc...or I should do a ButtonProc....

    I could change the color of my Dialog ... (DialogProc), but not of my button.

    What I want to do, to simplify, is when I press a button 1 I want to change the color button 2.

    Someone could write some words about it to clarify this issue (please WinAPI).

    Thanks

  2. #2
    Join Date
    May 2005
    Location
    Oregon
    Posts
    3,725

    Lightbulb Re: button color

    Quote Originally Posted by rafraf
    ok, I have seen a lot of threads about changing button color but.... (some using MFC, what confuses me...)

    I could not understand where I should put the notification...
    case WM_CTLCOLORDLG:
    and how to handle this.

    It it inside my DialogProc...or I should do a ButtonProc....

    I could change the color of my Dialog ... (DialogProc), but not of my button.

    What I want to do, to simplify, is when I press a button 1 I want to change the color button 2.

    Someone could write some words about it to clarify this issue (please WinAPI).

    Thanks
    before Posting any new thread just search it on code guru.There is already a lot of Example Present for color button .

    and

    The WM_CTLCOLORDLG message is sent to a dialog box before the system draws the dialog box. By responding to this message, the dialog box can set its text and background colors using the specified display device context handle.

    Syntax


    WM_CTLCOLORDLG WPARAM wParam LPARAM lParam;
    'CButton' is the only control that does not respond to the 'OnCtlColor()' message handler even though the MSDN explains it that way. To change the color of a 'CButton' control you have to set the style to ownerdrawn and do it yourself.

    You will find a complete 'CColorButton' http://www.codeguru.com/Cpp/controls...icle.php/c2087. This class does not allow you to change the color at run-time...you will find a modified control http://www.codeguru.com/buttonctrl/ClrButton.html
    Last edited by humptydumpty; October 24th, 2005 at 07:25 AM.

  3. #3
    Join Date
    Oct 2004
    Posts
    38

    Re: button color

    But I believe those examples make use of MFC....

    and about WinAPI...

    This is what confuses me... those codes can be implemented to a winAPI application ?

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured