Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Changing Foreground color on a CommandButton

Posted on 1998-09-03
10
Medium Priority
?
428 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:dougr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 3

Accepted Solution

by:
a111a111a111 earned 50 total points
ID: 1432791
Hi,
Not with Vb properties.
You can make an Icon or a BMP file.

BUT Why not using a simple label to do the job of the command button?


0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1432792
If you want  example.
I will post it here.
0
 

Author Comment

by:dougr
ID: 1432793
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!

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Expert Comment

by:a111a111a111
ID: 1432794
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!!!!

0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1432795
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.
0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1432796
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.
0
 

Author Comment

by:dougr
ID: 1432797
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
0
 
LVL 3

Expert Comment

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

See if you like it.

Shay.
0
 

Author Comment

by:dougr
ID: 1432799
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
0
 

Author Comment

by:dougr
ID: 1432800
To: a111a111a111

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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question