Skip to content

DFGetDFColor - cWinReport2

Converts individual R(ed), G(reen), B(lue) values into a WinPrint2 color value.

Type: Function
Return Data Type: Integer

Parameters

Parameter Type Description
iRed Integer Red value
iGreen Integer Green value
iBlue Integer Blue value

Syntax

Function DFGetDFColor Integer iRed Integer iGreen Integer iBlue Returns Integer

Call Example

Get DFGetDFColor iRed iGreen iBlue to IntegerVariable

Description

WinPrint2 provides a number of standard color constants that can be used in a report. Those constants are:

Regular colors Dark colors
RGB_BLACK
RGB_WHITE
RGB_BLUE RGB_DBLUE
RGB_CYAN RGB_DCYAN
RGB_GREEN RGB_DGREEN
RGB_GREY RGB_DGREY
RGB_MAGENTA RGB_DMAGENTA
RGB_RED RGB_DRED
RGB_YELLOW RGB_DYELLOW

With the DFGetDFColor function, you can create any color you desire for output. You pass separate values for Red, Green and Blue and a single WinPrint2 color value is returned.

Procedure SubHeader1
    integer iClr
    DFFont "Arial" //  Use Arial
    DFFontSize 8
    Get DFGetDFColor of winprintId  242 242 242 to iClr 

    DFBeginHeader DFSubHeader 1 // customer sub-header
        DFHeaderFrame hdr_Margins 0.01 rgb_dGrey iClr
        DFHeaderPos   HDR_LEFT
        DFHeaderWrap HDR_WRAP
        DFHeaderLineCheck 10

        DFWritePos    "Customer Number"         0.10  (FONT_BOLD+RGB_DBLUE)
        DFWritelnPos  Customer.CUSTOMER_NUMBER    4.0
        DFWritePos    "Name"                    0.10  (FONT_BOLD+RGB_DBLUE)
        DFWritelnPos  Customer.NAME               4.0   (FONT_DEFAULT)
        DFWritePos    "Address"                 0.10  (FONT_BOLD+RGB_DBLUE)
        DFWritelnPos  Customer.ADDRESS            4.0   (FONT_DEFAULT)
        DFWritePos    "City"                    0.10  (FONT_BOLD+RGB_DBLUE)
        DFWritelnPos  Customer.CITY               4.0   (FONT_DEFAULT)
        DFWritePos    "State"                   0.10  (FONT_BOLD+RGB_DBLUE)
        DFWritelnPos  Customer.STATE              4.0   (FONT_DEFAULT)
        DFWritePos    "Zip"                     0.10  (FONT_BOLD+RGB_DBLUE)
        DFWritelnPos  Customer.ZIP                4.0   (FONT_DEFAULT)
    DFEndHeader
End_Procedure

You can also use the RGBToWPColor function to convert a standard RGB color to a WinPrint2 color.

See Also

RGBToWPColor

Return Value

Returns a WinPrint2 RGB color value