Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Description

Excerpt

Changes the RGB value of a specified Color object, and updates all objects referencing that color.

Signature
C#C#
Wiki Markup
{description}
{excerpt}Changes the RGB value of a specified [Color] object, and updates all objects referencing that color.{excerpt}
{signature:C#}
 public void SetColor(Color color, int red, int green, int blue)
Signature
{signature}{signature:vb.net
vb.net
}
Public Sub SetColor(ByVal color As Color, ByVal red As Integer, ByVal green As Integer, ByVal blue As Integer)
Parameters
Param
colorcolorThe Color object to modify. This must be a Palette color
{signature}
{parameters}
{param:color}The {{Color}} object to modify. This must be a Palette color \(i.e. [Color.IsPaletteColor|Color.IsPaletteColor] must return true\).
Param
redred

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

Param
greengreen

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

Param
blueblue

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

Exceptions

...

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

...

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.

{param}
{param:red}The red component of the desired color. Must be between 0 and 255.{param}
{param:green}The green component of the desired color. Must be between 0 and 255.{param}
{param:blue}The blue component of the desired color. Must be between 0 and 255.{param}
{exceptions}
{exception:System.ArgumentException}If the given Color is not a palette color, see [Color.IsPaletteColor]{exception}
{exception:System.ArgumentOutOfRangeException}If the given red, green, or blue value does not fall between 0 and 255.{exception}
{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.
{remarks}
{example}{code:csharp|title=C#}
palette.SetColor(clr, 162, 221, 138);
{code}
{code:vb.net
|title=vb.net
}
palette.SetColor(clr, 162, 221, 138)
{code}

{example}
Example
Code Block
csharpcsharp
titleC#
Code Block
vb.nettitle