Results 1 to 25 of 25

Thread: How do you change the text color on a command button?

  1. #1

    Thread Starter
    Member mafia_geek's Avatar
    Join Date
    Jan 2002
    Location
    California
    Posts
    45

    Question How do you change the text color on a command button?


    if it is possible could someone tell me how to change the color of the text on a command button?
    -mafia_geek-

    Condito, Ergo Sum

  2. #2
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    Set the Style to Graphical in the Propertys window... Then set its backcolor to whatever you want.
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  3. #3

    Thread Starter
    Member mafia_geek's Avatar
    Join Date
    Jan 2002
    Location
    California
    Posts
    45
    thanks
    -mafia_geek-

    Condito, Ergo Sum

  4. #4
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    That'll only change the colour of the button itself - it's not actually possible to change the text colour.

    The only way would be to make/download an activeX control which has this allowed...
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  5. #5
    Addicted Member Guru's Avatar
    Join Date
    May 2000
    Location
    sulking in the cupboard under the stairs
    Posts
    237
    You can use a checkbox instead

    set its style=graphical

    Code:
    Option Explicit
    
    Private Sub Check1_Click()
    Check1.Value = Unchecked
    
    'put your normal command code here
    
    
    
    
    End Sub
    Another light-hearted post from Guru

  6. #6

    Thread Starter
    Member mafia_geek's Avatar
    Join Date
    Jan 2002
    Location
    California
    Posts
    45
    i see...
    -mafia_geek-

    Condito, Ergo Sum

  7. #7
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    Ohh my bad i thought you said Backcolor not forecolor.
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  8. #8
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    use the module i atached andhere is how you would use it

    SetButton Command1.hWnd, vbWhite
    Attached Files Attached Files

  9. #9
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    That doesn't actually seem to do anything...
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  10. #10
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    ya it does......just set the style to graphical and then the backcolor to black or what ever and then use this in the form load setbutton yourcommandname.hwnd, yourforecolor

    add the moduale and this form that i attached and try it

  11. #11
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    You forgot to mention the .Style = Graphical bit...
    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

  12. #12
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    This is what I have been using lately. I think the module is something Serge had post that I modified.

  13. #13
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    Also if you have Microsoft Office installed, then you could check out "Microsoft Forms 2.0 Form" in components. It has a command button with a ForeColor property. If you don't see it in the components list, check the Designer tab and see if it is listed there.

  14. #14
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    ya that will work 2

  15. #15
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    Overlay a textbox over the top of a command button
    1. Create a textbox with borderstyle = none, backcolor = &H8000000A&
    2. Set the forecolor to whatever you want and the text property to whatever you want the button's caption to be.

    3. Under the [format] menu [order] send the command button to the back and Bring the textbox to the front and position the textbox over the command button.

    then under the text1_click event simply call the command button click event.
    eg.
    Private Sub Text1_Click()
    Me.Command1.SetFocus
    Call Command1_Click
    End Sub


    As forms 2.0 is not redistributable with your application, you could also use the SS Sheridan Command Button as it has a forecolor property.
    Ships with Vb

    It is stored on your Install disk.
    Look under Vb/Controls/THREED32.ocx
    Copy that file into Windows\System
    then when you open a new project you will see Sheridan Controls

  16. #16
    Fanatic Member dongaman's Avatar
    Join Date
    Aug 2001
    Location
    xi'an
    Posts
    616
    I would like use a label to make it "like" a command button
    I am just aman.

  17. #17
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    are you talking about 3d buttons or flat buttons dongaman?

  18. #18
    Fanatic Member dongaman's Avatar
    Join Date
    Aug 2001
    Location
    xi'an
    Posts
    616
    yes
    I am just aman.

  19. #19
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    yes,no, maybe, perhaps not...

  20. #20
    Fanatic Member dongaman's Avatar
    Join Date
    Aug 2001
    Location
    xi'an
    Posts
    616
    Right,it is just a test.
    I am just aman.

  21. #21
    Addicted Member Guru's Avatar
    Join Date
    May 2000
    Location
    sulking in the cupboard under the stairs
    Posts
    237
    Originally posted by Nucleus
    Overlay a textbox over the top of a command button
    1. Create a textbox with borderstyle = none, backcolor = &H8000000A&
    2. Set the forecolor to whatever you want and the text property to whatever you want the button's caption to be.

    3. Under the [format] menu [order] send the command button to the back and Bring the textbox to the front and position the textbox over the command button.

    then under the text1_click event simply call the command button click event.
    eg.
    Private Sub Text1_Click()
    Me.Command1.SetFocus
    Call Command1_Click
    End Sub
    Yuk!
    That's messy.
    Another light-hearted post from Guru

  22. #22
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    Well it works without any extra dependencies, what would you recommend to avoid using extra dependencies soi-disant Guru?

  23. #23
    Addicted Member Guru's Avatar
    Join Date
    May 2000
    Location
    sulking in the cupboard under the stairs
    Posts
    237
    Originally posted by Nucleus
    Well it works without any extra dependencies, what would you recommend to avoid using extra dependencies soi-disant Guru?



    Originally posted by Guru earlier in this thread (not that anybody bothered to read it!)
    You can use a checkbox instead

    set its style=graphical

    Code:
    Option Explicit
    
    Private Sub Check1_Click()
    Check1.Value = Unchecked
    
    'put your normal command code here
    
    End Sub
    Last edited by Guru; Jan 31st, 2002 at 05:21 AM.
    Another light-hearted post from Guru

  24. #24
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    *cough* checkbox doesn't look and feel as nice as a proper command button *cough*.

  25. #25
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033
    use this:
    Attached Files Attached Files
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

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