SetRTFColor

<< Click to Display Table of Contents >>

Navigation:  RTF Functions >

SetRTFColor

Previous pageReturn to chapter overviewNext page

Modify the build-in RTF color table.

method void VPE.SetRTFColor(

long ID,

Color Color

)

long ID

the entry ID

Color Color

any of the "COLOR_xyz" constants described in Programmer's Manual

or ActiveX / VCL: any RGB value

or .NET: any member of the .NET Color structure

that shall be assigned to the given entry-id

Remarks:

RTF offers no way to set a transparent background mode, like VPE does. So we decided to set the background mode to transparent, in case you are using COLOR_WHITE = RGB(255, 255, 255) as background color.

 

VPE has build-in a predefined color table:

color1

BLACK

RGB(0, 0, 0)

color2

DKGRAY

RGB(128, 128, 128)

color3

GRAY

RGB(192, 192, 192)

color4

LTGRAY

RGB(230, 230, 230)

color5

WHITE

RGB(255, 255, 255)

color6

DKRED

RGB(128, 0, 0)

color7

RED

RGB(192, 0, 0)

color8

LTRED

RGB(255, 0, 0)

color9

DKORANGE

RGB(255,  64, 0)

color10

ORANGE

RGB(255, 128, 0)

color11

LTORANGE

RGB(255, 192, 0)

color12

DKYELLOW

RGB(224, 224, 0)

color13

YELLOW

RGB(242, 242, 0)

color14

LTYELLOW

RGB(255, 255, 0)

color15

DKGREEN

RGB(0, 128, 0)

color16

GREEN

RGB(0, 192, 0)

color17

LTGREEN  

RGB(0, 255, 0)

color18

HIGREEN

RGB(0, 255, 128)

color19

BLUEGREEN

RGB(0, 128, 128)

color20

OLIVE

RGB(128, 128, 0)

color21

BROWN

RGB(128,  80, 0)

color22

DKBLUE

RGB(0, 0, 128)

color23

BLUE

RGB(0, 0, 255)

color24

LTBLUE

RGB(0, 128, 255)

color25

LTLTBLUE

RGB(0, 160, 255)

color26

HIBLUE

RGB(0, 192, 255)

color27

CYAN

RGB(0, 255, 255)

color28

DKPURPLE

RGB(128, 0, 128)

color29

PURPLE

RGB(192, 0, 192)

color30

MAGENTA

RGB(255, 0, 255)

Examples:

change color1 with

ActiveX / VCL

Doc.SetRTFColor(1, RGB(10, 10, 10))

 

.NET

Doc.SetRTFColor(1, Color.FromArgb(10, 10, 10))

 

Or you can add as many colors to the table as you like, for example:

ActiveX / VCL

Doc.SetRTFColor(31, COLOR_GREEN)

 

.NET

Doc.SetRTFColor(31, Doc.COLOR_GREEN)

or

Doc.SetRTFColor(31, Color.Green

 

See also:

"RTF - Rich Text Format" in the Programmer's Manual