ToRGB, ColorToRGB

[Top]  [Chapter]  [Previous]  [Next]

This two methods are available in the .NET interface to convert a .NET Color value into a RGB value:

 

public int ToRGB(Color aColor)

 {

     return (aColor.R|(aColor.G<<8)|(aColor.B<<16));

 }

 

public int ColorToRGB(Color aColor)

 {

     return (aColor.R|(aColor.G<<8)|(aColor.B<<16));

 }

 

Once a color was used by the editor it is entered into a color table. The attributes store only the index in this color table.

 

You can use the utility method public Color[] GetColorList() to extract the color table.

 

 

To convert a RGB value into the Color type use

 

the API ColorTranslator.FromWin32(rgb) .


[tocolor.htm]    Copyright © 2007 by WPCubed GmbH