Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Button Text

Status
Not open for further replies.

iamondtron

IS-IT--Management
Jan 24, 2002
10
US
Hello and thanks in advance. Is there a way to change the color of a COMMAND BUTTON TEXT. Currently it displays in BLACK TEXT as a default. I'm new to VB, so any tips or links to anything will be helpfull.

:cool:
KJG
 
I think you might be able to do it with a Windows API. I always use a label instead of a command button when I want different colors cause VB does not let you modify the drab command button. I have an ActiveX control command button which is a replacement for command button.

Check it out at
This same guy has some other neat controls also - for creating gradient screens, etc.
 
The background colour of the command button can be changed if you set the button's style property to "Graphical". I don't know about the foreground colour...

 
One other thing you may want to try is a checkbox (gasp!). They have a 'Style' property, which can be set to Graphical.

Code:
Dim done As Boolean

Sub Check1_Click

 Select Case Check1.Value
  Case vbChecked
   Check1.ForeColor = vbWhite (?)
   Do
    DoEvents
    Call Look_Busy   :-P
   Loop until Done
  Case vbUnchecked
   Done = True
   Check1.ForeColor = vbBlack
 End Select

End Sub

With this code, the check box stays depressed for the duration of the action. I use this is my programs (Server - client stuff), because it takes a finite amount of time for the transaction to occur, and it looks awesome to have the button remain depressed for the duration of the processing. Of course, I also disable the controls on the form during this, too, which just adds to the effect. :)

Hope this helps,
~Bryan B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top