ColorObject Class
This object used to store, convert colors.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.XlsIO.Implementation
Assembly: Syncfusion.XlsIO.Base.dll
Syntax
public class ColorObject : IDisposable
Constructors
ColorObject(ExcelKnownColors)
Initializes new instance of the color object.
Declaration
public ColorObject(ExcelKnownColors color)
Parameters
Type | Name | Description |
---|---|---|
ExcelKnownColors | color | Color value to initialize. |
ColorObject(ColorType, Int32)
Initializes a new instance of the ColorObject class.
Declaration
public ColorObject(ColorType colorType, int colorValue)
Parameters
Type | Name | Description |
---|---|---|
ColorType | colorType | Represents type of Color. |
System.Int32 | colorValue | Represents color value. |
ColorObject(ColorType, Int32, Double)
Initializes a new instance of the ColorObject class.
Declaration
public ColorObject(ColorType colorType, int colorValue, double tint)
Parameters
Type | Name | Description |
---|---|---|
ColorType | colorType | Represents color type. |
System.Int32 | colorValue | Represents color value. |
System.Double | tint | Represents tint value. |
ColorObject(Color)
Initializes new instance of the color object.
Declaration
public ColorObject(Color color)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | Color value to initialize. |
Properties
ColorType
Returns type of the stored color.
Declaration
public ColorType ColorType { get; set; }
Property Value
Type |
---|
ColorType |
Tint
Gets or sets Tint.
Declaration
public double Tint { get; set; }
Property Value
Type |
---|
System.Double |
Value
Returns color value (it can be index, rgb color, etc.)
Declaration
public int Value { get; }
Property Value
Type |
---|
System.Int32 |
Methods
Dispose()
Dispose
Declaration
public void Dispose()
Equals(Object)
Determines whether the specified Object is equal to the current Object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The Object to compare with the current Object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified Object is equal to the current Object; otherwise, false. |
Overrides
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A 32-bit signed integer hash code. |
Overrides
GetIndexed(IWorkbook)
Returns index for indexed color or the closest color for any other color type.
Declaration
public ExcelKnownColors GetIndexed(IWorkbook book)
Parameters
Type | Name | Description |
---|---|---|
IWorkbook | book | Parent workbook |
Returns
Type | Description |
---|---|
ExcelKnownColors | Index for indexed color or the closest color for any other color type. |
GetRGB(IWorkbook)
Returns RGB Color object that corresponds to this color.
Declaration
public Color GetRGB(IWorkbook book)
Parameters
Type | Name | Description |
---|---|---|
IWorkbook | book | Parent workbook. |
Returns
Type | Description |
---|---|
System.Drawing.Color | RGB Color object that corresponds to this color. |
SetIndexed(ExcelKnownColors)
Sets indexed color.
Declaration
public void SetIndexed(ExcelKnownColors value)
Parameters
Type | Name | Description |
---|---|---|
ExcelKnownColors | value | Color index to set. |
SetIndexed(ExcelKnownColors, Boolean)
Sets indexed color.
Declaration
public void SetIndexed(ExcelKnownColors value, bool raiseEvent)
Parameters
Type | Name | Description |
---|---|---|
ExcelKnownColors | value | Color index to set. |
System.Boolean | raiseEvent |
SetIndexed(ExcelKnownColors, Boolean, WorkbookImpl)
Sets the indexed.
Declaration
public void SetIndexed(ExcelKnownColors value, bool raiseEvent, WorkbookImpl book)
Parameters
Type | Name | Description |
---|---|---|
ExcelKnownColors | value | Color index to set. |
System.Boolean | raiseEvent | if set to |
WorkbookImpl | book | The book. |
SetIndexedNoEvent(ExcelKnownColors)
Sets indexed color without calling AfterChange event.
Declaration
public void SetIndexedNoEvent(ExcelKnownColors value)
Parameters
Type | Name | Description |
---|---|---|
ExcelKnownColors | value | Color index to set. |
SetRGB(Color, IWorkbook)
Sets RGB color value.
Declaration
public void SetRGB(Color value, IWorkbook book)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | value | Value to set. |
IWorkbook | book | Parent workbook. |
SetRGB(Color, IWorkbook, Double)
Sets rgb color.
Declaration
public void SetRGB(Color rgb, IWorkbook book, double dTintValue)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | rgb | Rgb color to set. |
IWorkbook | book | Parent workbook. |
System.Double | dTintValue | Tint value. |
SetTheme(Int32, IWorkbook)
Sets theme color.
Declaration
public void SetTheme(int themeIndex, IWorkbook book)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | themeIndex | Theme color index. |
IWorkbook | book | Parent workbook. |
SetTheme(Int32, IWorkbook, Double)
Sets theme color
Declaration
public void SetTheme(int themeIndex, IWorkbook book, double dTintValue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | themeIndex | Theme color index. |
IWorkbook | book | Parent workbook. |
System.Double | dTintValue | Tint value. |
Events
AfterChange
Event called after color change.
Declaration
public event ColorObject.AfterChangeHandler AfterChange
Event Type
Type |
---|
ColorObject.AfterChangeHandler |
Operators
Equality(ColorObject, ColorObject)
Checks whether two instance have the same data.
Declaration
public static bool operator ==(ColorObject first, ColorObject second)
Parameters
Type | Name | Description |
---|---|---|
ColorObject | first | First color object to check. |
ColorObject | second | Second color object to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if they have the same data. |
Implicit(Color to ColorObject)
Conversion operator.
Declaration
public static implicit operator ColorObject(Color color)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | Value to convert. |
Returns
Type | Description |
---|---|
ColorObject | Converted item. |
Inequality(ColorObject, ColorObject)
Checks whether two instances have different data.
Declaration
public static bool operator !=(ColorObject first, ColorObject second)
Parameters
Type | Name | Description |
---|---|---|
ColorObject | first | First color object to check. |
ColorObject | second | Second color object to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if they have different data. |