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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Colored check in checkbox?

Status
Not open for further replies.

bfwriter

Technical User
Jul 22, 2006
35
US
Hello friends,

Is there a method to control the color of the check in a checkbox control? I need to alter the color depending upon other "mode" settings of the form (in this case, between green and red check marks).

Thanks.
 
I'm not aware of anyway to do this, but it's not a good idea. Many users are color blind and may not be able to differentiate between one color and another.

Craig Berntson
MCSD, Visual FoxPro MVP,
 
I just did a test and found that, while the color of the check itself cannot be changed easily, you can programatically change the BackColor property of the Caption.

Code:
DO CASE
   CASE <whatever>
      ThisForm.Check1.BackColor = RGB(255,0,0)  && Red

   CASE <whatever2>
      ThisForm.Check1.BackColor = RGB(0,255,0)  && Green

   OTHERWISE
      ThisForm.Check1.BackColor = RGB(212,208,200)  && Default Color
ENDCASE

You can also change the ForeColor of the Caption in the same manner.

But I also agree with Craig above.

If you are going to change the color in some manner, you might also change the Caption, Border, Font, FontBold property so as to create a visual difference which would also be seen by color blind people as well.

Good Luck,
JRB-Bldr
 
Another way to go would be to change the style to graphical and then you could change the picture property based on the state of the control. You could also change the backcolor as well.

Set the ThisForm.Check1.style = 1

You could put this in the click event of Check1

DO CASE
CASE this.value = 0
This.Check1.picture = "JPG1.jpg"
CASE this.value = 1
This.Check1.picture = "JPG2.jpg"
ENDCASE

Ed
 
Sorry, it should be

DO CASE
CASE this.value = 0
This.picture = "JPG1.jpg"
CASE this.value = 1
This.picture = "JPG2.jpg"
ENDCASE

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top