So, What Are The “Default” Colors Anyway?

The default colors are driven by the values returned by the GetSysColor function in the Windows API. We’ll be using GetSysColor when creating custom controls later in the series.

I’ve included a form, frmGetColors.scx (the download link is at the end of this post), which shows all of the current GetSysColor values based on the current Windows color scheme (or theme).

The form (pictured below) includes some Windows Event Binding code (which I stole leveraged from Tamar’s BINDEVENTS session), to automatically update the form when the Windows theme changes.

frmGetColors shows current Windows color scheme values

frmGetColors shows current Windows color scheme values

To use the GetSysColor function in Visual FoxPro, simply DECLARE the function, and then call it with one of the API Param numbers shown in the figure above:

?GetSysColor(15) && 3DFACE (Buttons, forms)

More information about the GetSysColor Windows API function at MSDN

Download the file here