Link to home
Start Free TrialLog in
Avatar of dougr
dougr

asked on

Changing Foreground color on a CommandButton

In VB5 I want to change the colors on a CommandButton to show a White Caption on a Red Backgound.

If  I change the Style property of the CommandButton to 1 (Graphical) and the BackColor property to VBRed then I get the background color I want.  However, there is no ForeColor property listed for a CommandButton, so the Caption letters remain Black, which is hard to read on the Red background.

Is there any way to do this, perhaps with an API call?

dougr
ASKER CERTIFIED SOLUTION
Avatar of a111a111a111
a111a111a111

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of a111a111a111
a111a111a111

If you want  example.
I will post it here.
Avatar of dougr

ASKER

To: a111a111a111

Thank you for your answer.  Can you make a Label look EXACTLY like a CommandBox with the raised 3-D effect etc?  If so, I welcome your code and will award the points. Whenever I have tried it, it either looks "flat" or if you put a border on it it looks like a TextBox".  There is also the little "shadow" effect on a CommandButton when it has the focus which is hard to create.

Otherwise how do you make an icon to look exactly like the text on a CommandButton?

dougr

PS What kind of a name is "a111a111a111".  If it is in HEX, I think it works out to 177,097,088,803,089 in Decimal.  Perhaps this is the distance to the nearest inhabited solar system!

Well First The name a111a111a111 was registered here because when I tried
to register as Shay It came back as name been use choose a diffrent one
then I tried Shay_E and so and so.

And I got suck with it because The sysytem here not allow you you change user name!!!!

Hi, I tried with
Option Explicit

Private Sub Form_Load()
Picture1.Picture = LoadPicture("e:\command3-1.gif")
End Sub

Private Sub Picture1_Click()
Picture1.Picture = LoadPicture("e:\command3-2.gif")
End Sub


But it is not the same as you like.

So i guess you have to do some API for this one.
Hi, I tried with
Option Explicit

Private Sub Form_Load()
Picture1.Picture = LoadPicture("e:\command3-1.gif")
End Sub

Private Sub Picture1_Click()
Picture1.Picture = LoadPicture("e:\command3-2.gif")
End Sub


But it is not the same as you like.

So I guess you have to do some API for this one.
Avatar of dougr

ASKER

To: a111a111a111

Thanks for the comments you made.  Unfortunately I am not too much closer to solving this puzzle.  Perhaps as you suggest it can't be done using the CommandButton properties, and anything else trying to SIMULATE a CommandButton (with labels, pictures, icons, BMP's etc.) just gets too complicated.

dougr
Hi I code a small project for you to dwonload from:
http://www.hili.com/~shay/menutest.zip

See if you like it.

Shay.
Avatar of dougr

ASKER

To: a111a111a111 (Shay)

Thanks for the little project you sent me.  It is heat how you created the little picture boxes with the icons in them.  I assume you have the originals of these little icons (bitmaps) stored on your disk somewhere because they were not in the zip file you sent.

This of course does not directly address the problem I am trying to solve, but I appreciate receiving this example of programming technique.  I am sure I will be able to use it in a future program I write.

I guess it is also possible to put bitmaps on top of Command Buttons to simulate the effect that I want.

dougr
Avatar of dougr

ASKER

To: a111a111a111

My comment should read "it is neat ...." NOT "it is heat"!