Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: reformatted and added exceptions
Description

Excerpt

Changes the RGB value of a specified Color object. Color must be a palette color. Any objects that reference this color object will be updated to use the new RGB values. For .xlsx files, this alters the legacy palette, which is used when opening the file in Excel 2003., and updates all objects referencing that color.

Signature
C#
C#
 public void SetColor(Color color, int red, int green, int blue)

...

Param
blue
blue

The blue component of the desired color. Must be between 0 and 255.

Exceptions
Exception
System.ArgumentException
System.ArgumentException

If the given Color is not a palette color, see Color.IsPaletteColor

Exception
System.ArgumentOutOfRangeException
System.ArgumentOutOfRangeException

If the given red, green, or blue value does not fall between 0 and 255.

Remarks

Any objects that reference this color object will be updated to use the new RGB values. For .xlsx files, this alters the legacy palette, which is used when opening the file in Excel 2003, but still updates objects referencing the given palette color.

Example
Code Block
csharp
csharp
titleC#
palette.SetColor(clr, 162, 221, 138);
Code Block
vb.net
vb.net
titlevb.net
palette.SetColor(clr, 162, 221, 138)