Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change BG Color on Command Button
Message
From
17/10/2000 03:57:04
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00430072
Message ID:
00430201
Views:
9
>Hi,
>
>How do you change the backcolor color of a Command Button? Can't seem to get it to change.
>
>Thanks in advance!
>Roland...

Roland,
You can't directly change backcolor of a button from VFP. But visually there are ways to make virtually anything a button on form.

-You could simply place image, label, shape etc in front of a button
Problem : You should manually code a call to commandbutton's click for each :(

-You could directly use an image, label, shape etc
Problem : Controls are generally flat which do not look like a button + most of them do not get focus with keyboard. If multipl then again code to call the same click routine :(

-You could place an 'invisible' (style property) button over a group of image, label, shape etc
Better than others
Problem : Flat and you lose mousedown-mouseup visual effects of a commandbutton :(

-Well best solution IMHO is to use a container. With its SpecialEffect property a container could easily mimic a commandbutton. Below is the easiest implementation of concept :

On a form put image, label, shape etc (whatever you want).
On top of them place a container with properties :
SpecialEffect = 0 && Raised
BackStyle = 0 && Transparent
On top of container place a commandbutton with Style invisible (to get focus like any other commandbutton with keyboard).

There you go. In MouseDown, MouseUp you could change the SpecialEffect of container (+ any other control's color, caption etc) to give a feel of pressed button. ie : Mousedown
with this.parent.fakeContainer
.SpecialEffect = 1 && Sunken
.Visible = .Visible
endwith

Combined with MouseMove code and OnMouseOut (a class in files\classes section) you're vey close to creating coolbuttons like IE toolbar :)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform