Faceți căutări pe acest blog

miercuri, 19 august 2015

Changing the color of grid's HighlightRowLine

The selected row of a Grid is emphasized with a border around it.
The thickness can be controlled with the grid's HighlightRowLineWidth property.
But there is no HighlightRowLineColor property, and this color is given by the OS's "Selected Items" color.

In Windows 7 can be accessed this way :
Control Panel -> Personalization -> Window Color -> Selected Items (chosen from the combobox)
In Windows 10, I haven't found yet where it can be (I suppose lies in some registry key).

But a small VFP code can help you :
************
* Begin Code

************
Declare integer SetSysColors in user32 integer, string, string
lnNewColor = 255
setsyscolors(1,BINTOC(13,'4RS'),BINTOC(m.lnNewColor,'4RS')) && 1 means a single color would be changed; 13 is the numeric code for Selected Item

************
* End Code
************

Here is a more complete code
************
* Begin Code
************
Declare integer GetSysColor in user32 integer
Declare integer SetSysColors in user32 integer, string, string
LOCAL lnNewColor,lnOldColor
lnOldColor = GetSysColor(13) && store the old color
lnNewColor = 255
setsyscolors(1,BINTOC(13,'4RS'),BINTOC(m.lnNewColor,'4RS')) && set new color
DO FORM MyFormContainingTheGrid && verify the grid
setsyscolors(1,BINTOC(13,'4RS'),BINTOC(m.lnOldColor,'4RS')) && restore the old color

************
* End Code
************

GetSysColor
SetSysColor
Another VFP example for GetSysColor and SetSysColor

Niciun comentariu:

Trimiteți un comentariu