BCX_COLORDLG function

Purpose: BCX_COLORDLG creates a color dialog box that enables the user to select a color which is returned as a COLORREF value specifying an RGB color.


Syntax:

 RetVal% = BCX_COLORDLG([DefaultColor][, hWndParent])

Parameters:

  • DefaultColor [OPTIONAL] The default COLORREF value to be set. If not set by the user the default is set to RGB(128,128,128).
  • hWndParent [OPTIONAL] Specifies the HWND type handle to the parent window if a modal dialog box is used.

Return Value:

  • RetVal% is a COLORREF value specifying a color.

Example:


 DIM Result$, ColorRef%
 
 ColorRef% = BCX_COLORDLG
 
 Result$ =        "COLORREF = " & STR$(ColorRef%) & CRLF$
 Result$ = Result$ & "RED   = " & STR$(GETRVALUE(ColorRef%)) & CRLF$
 Result$ = Result$ & "GREEN = " & STR$(GETGVALUE(ColorRef%)) & CRLF$
 Result$ = Result$ & "BLUE  = " & STR$(GETBVALUE(ColorRef%)) & CRLF$
 
 MSGBOX Result$
 

GETRVALUE function

Purpose: GETRVALUE returns an integer containing the intensity value for the red component of a red, green, blue(RGB) value.


Syntax:

 RetVal% = GETRVALUE(ColorRef%)

Parameters:

  • ColorRef% The COLORREF value specifying an RGB color.

Return Value:

  • RetVal% The value of the red component of the ColorRef% value.

GETGVALUE function

Purpose: GETGVALUE returns an integer containing the intensity value for the green component of a red, green, blue(RGB) value.


Syntax:

 RetVal% = GETGVALUE(ColorRef%)

Parameters:

  • ColorRef% The COLORREF value specifying an RGB color.

Return Value:

  • RetVal% The value of the green component of the ColorRef% value.

GETBVALUE function

Purpose: GETBVALUE returns an integer containing the intensity value for the blue component of a red, green, blue(RGB) value.


Syntax:

 RetVal% = GETBVALUE(ColorRef%)

Parameters:

  • ColorRef% The COLORREF value specifying an RGB color.

Return Value:

  • RetVal% The value of the blue component of the ColorRef% value.

RGB function

Purpose: The RGB function returns a COLORREF value calculated from the red, green and blue arguments passed to the function.


Syntax:

 RetVal% = RGB(red%, green%, blue%)

Parameters:

  • red% An integer in the range 0 to 255 specifying the intensity of the red color.
  • green% An integer in the range 0 to 255 specifying the intensity of the green color.
  • blue% An integer in the range 0 to 255 specifying the intensity of the blue color.

Return Value:

  • RetVal% A COLORREF value in the range 0 to 16777215 which has the following hexadecimal form
    
     0x00bbggrr
    
    
    where "bb" is the hexadecimal representation of an integer containing the intensity value for the blue component, "gg" is the hexadecimal representation of an integer containing the intensity value for the green component and "rr" is the hexadecimal representation of an integer containing the intensity value for the red component.