Click or drag to resize

PaletteRGB Function

X#
Get a particular color from a user-defined palette.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION PaletteRGB(
	bR AS USUAL,
	bG AS USUAL,
	bB AS BYTE
) AS LONG
Request Example View Source

Parameters

bR
Type: Usual
The amount of red in the color, as a number from 0 to 255.
bG
Type: Usual
The amount of green in the color, as a number from 0 to 255.
bB
Type: Byte
The amount of blue in the color, as a number from 0 to 255.

Return Value

Type: Long
The number of the color described, relative to the numbers of the other colors in the palette.
If the color described does not have a number in the palette, the next closest number is returned.
Remarks
PaletteRGB() can be used only with devices that support palettes that can be created by Windows programmers. See the Windows API PaletteRGB() function for more information on palettes.
Examples
This example uses PaletteRGB() to create a brush with a red color. CreateSolidBrush() and SelectObject() are defined in the Win32 API library:
X#
1hBr :=  CreateSolidBrush(PaletteRGB(255, 0, 0))
2SelectObject(hdc, hBr)
3// Select the created brush into the current DC
See Also