Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Shading a checkbox
Message
From
07/07/2011 15:37:27
 
 
To
07/07/2011 12:51:19
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Miscellaneous
Thread ID:
01517604
Message ID:
01517626
Views:
67
>Hi All:
>
>How do I shade the inside of a checkbox?
>
>I need this so that if I have a 'Select All' option, I would shade it if only some items are selected.
>
>Thanks,
>
>Yossi

Yossi,

As others pointed out to you, the coloring with a checkbox are natively limited. However OnyToo has published a class to colour a checkbox.
**************************************************
*-- Class:        colouredcheckbox (e:\foxexamples\checkbox\colouredcheckbox.vcx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   07/07/11 09:32:08 PM
*-- Author:       OnyToo
DEFINE CLASS colouredcheckbox AS form


	Top = 0
	Left = 0
	Height = 126
	Width = 199
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"


	ADD OBJECT check1 AS checkbox WITH ;
		Top = 24, ;
		Left = 24, ;
		Height = 17, ;
		Width = 60, ;
		AutoSize = .T., ;
		Alignment = 0, ;
		BackStyle = 0, ;
		Caption = "Check1", ;
		Value = 0, ;
		Visible = .T., ;
		BackColor = RGB(255,0,0), ;
		Name = "Check1"


	PROCEDURE Paint
		lnForeColor = This.ForeColor
		lnDrawWidth = This.DrawWidth
		This.DrawWidth = 2

		With This.Check1
			This.ForeColor = .BackColor
			This.Box(.Left, .Top+2, .Left+13, .Top+15)
			If !Empty(.Value)
				This.Line(.Left+4, .Top+8, .Left+6, .Top+12)
				This.Line(.Left+6, .Top+12, .Left+9, .Top+5)
			Endif
		Endwith
		This.DrawWidth = lnDrawWidth
		This.ForeColor = lnForeColor
	ENDPROC


	PROCEDURE check1.InteractiveChange
		If Empty(This.Value)
			This.BackColor = Rgb(0,0,255)
		Else
			This.BackColor = Rgb(255,0,0)
		Endif
	ENDPROC


ENDDEFINE
*
*-- EndDefine: colouredcheckbox
**************************************************
Maybe his coding is a good starter for your problem.

Best regards,

Koen
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform