CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 1998
    Posts
    2

    Changing Button Color



    I have several push buttons in a form.

    When a button has got focus, I want to change that button's color to red.

    How I can do that?

    Thanks in advance.



  2. #2
    Join Date
    May 1999
    Posts
    10

    Re: Changing Button Color



    At desgin time you have to change the Style-property of the button to

    1-graphical.

    Then add GotFocus and LostFocus to your code.


    Private Sub Command2_GotFocus()

    Command2.BackColor = &HFF&

    End Sub


    Private Sub Command2_LostFocus()

    Command2.BackColor = &H8000000F

    End Sub



  3. #3
    Join Date
    Nov 1998
    Posts
    23

    Re: Changing Button Color



    The only way i know to do that is to make sure that STYLE is set to Graphic and then assign a blank .bmp with a colour of your choice to the DOWNPICTURE property for that button.


    Hope this helps.


    Christopher



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