BCX_SET_FORM_COLOR statement

Purpose: BCX_SET_FORM_COLOR will color a Control according to the value in RGBFormColor.


 Syntax 1:

 BCX_SET_FORM_COLOR hWnd,RGBFormColor

 Syntax 2:

 BCX_SET_FORM_COLOR(hWnd,RGBFormColor)

 Parameters:

  • hWnd Handle to Form on which color is to be set.
  • RGBFormColor RGB(r,g,b) expression for color to be set on Form.

Example:


 BCX_SET_FORM_COLOR FORM1, RGB(0,0,0)

Result: FORM1 will be black

Example:


 BCX_SET_FORM_COLOR FORM1, RGB(255,255,255)

Result: FORM1 will be white

For an example of the BCX_SET_FORM_COLOR statement see FontDemo.bas.

Notes: Normally, you only need to issue this command once, so it is best to issue it in SUB FORMLOAD before calling SHOW(YourForm).

BCX_SET_FORM_COLOR forces Windows to redraw your Form each time that you use command is executed. This can lead to severe flicker and other undesirable effects.

NEVER use this command directly in the BEGIN EVENTS loop.

For example: Never do this!


 BEGIN EVENTS
  BCX_SET_FORM_COLOR(Form1, RGB(128,128,128),(64,64,64))
 END EVENTS

Instead, tie the command to a particular event, like this:


 BEGIN EVENTS
  SELECT CASE WM_COMMAND
  CASE ID_I_WANT_TO_CHANGE_THE_COLORS_NOW
  BCX_SET_FORM_COLOR(Form1, RGB(128,128,128),(64,64,64))
  END SELECT
 END EVENTS

QBCOLOR statement

Purpose: QBCOLOR returns a Long representing the RGB color code corresponding to the specified color number.


 Syntax:

 QBCOLOR(TheColor%)

 Parameters:

  • TheColor% The required color argument is an integer in the range 0-31.
    • 0 Black
    • 1 Blue
    • 2 Green
    • 3 Cyan
    • 4 Red
    • 5 Magenta
    • 6 Brown
    • 7 White
    • 8 Gray
    • 9 Light Blue
    • 10 Light Green
    • 11 Light Cyan
    • 12 Light Red
    • 13 Light Magenta
    • 14 Yellow
    • 15 Bright White
    • Additionally, colors 16 thru 31 provide softer, pastel versions of colors 0 through 15.

Example:


 BCX_SET_FORM_COLOR(Form1, QBCOLOR(6)) ' set form to brown