Class Palette
Collection of Colors items
Inheritance
Namespace: FastReport.BG.Styling
Assembly: FastReport.BG.dll
Syntax
public class Palette : IList<Color>, ICollection<Color>, IEnumerable<Color>, IEnumerable, ISupportInitialize
Constructors
Palette(PaletteType)
Constructs a new palette with predefined colors
Declaration
public Palette(PaletteType paletteType)
Parameters
| Type | Name | Description |
|---|---|---|
| PaletteType | paletteType | Type of palette |
Palette(Color[])
Constructs a new custom colors palette
Declaration
public Palette(Color[] colors)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Color[] | colors | Array of palette colors |
Properties
Count
Count of colors in the palette
Declaration
[Browsable(false)]
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
IsReadOnly
Check if platte is read only
Declaration
[Browsable(false)]
public bool IsReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Item[Int32]
Get Color by index
Declaration
public Color this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | Index of color in the palette |
Property Value
| Type | Description |
|---|---|
| System.Drawing.Color | Palette color |
PaletteType
Type of palette
Declaration
public PaletteType PaletteType { get; set; }
Property Value
| Type | Description |
|---|---|
| PaletteType |
UserColors
User color collection
Declaration
[Browsable(true)]
public ObservableCollection<Color> UserColors { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.ObjectModel.ObservableCollection<System.Drawing.Color> |
Methods
Add(Color)
Add a new custom Color
Declaration
public void Add(Color item)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Color | item | Color to add |
Remarks
Does not change predefined color palette
Assign(Palette)
Copies all properties from the source Palette to current instance
Declaration
public void Assign(Palette source)
Parameters
| Type | Name | Description |
|---|---|---|
| Palette | source | Source palette |
BeginInit()
Begin Init.
Declaration
public void BeginInit()
Clear()
Clear custom color palette
Declaration
public void Clear()
Remarks
Does not change predefined color palette
Contains(Color)
Test if collection contains given color
Declaration
public bool Contains(Color item)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Color | item | Color to check |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if palette contains color;false if palette does not contain color |
CopyTo(Color[], Int32)
Copies the entrier color collection to array of Color, starting at the specified index of the target array
Declaration
public void CopyTo(Color[] array, int arrayIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Color[] | array | The one-dimensionnal array that is the destination of elements copied from the collection. |
| System.Int32 | arrayIndex | The index in array at which copying begins. |
Deserialize(XmlItem)
Deserialize from XMLItem
Declaration
public void Deserialize(XmlItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| XmlItem | item | XMLItem object |
EndInit()
End Init.
Declaration
public void EndInit()
GetEnumerator()
Gets IEnumerator interface
Declaration
public IEnumerator<Color> GetEnumerator()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerator<System.Drawing.Color> | IEnumerator interface |
IndexOf(Color)
Get the index of passed item in the collection
Declaration
public int IndexOf(Color item)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Color | item | item which index needs to be returned |
Returns
| Type | Description |
|---|---|
| System.Int32 | Zeo-based index of item in the collection or -1 if item is not found. |
Insert(Int32, Color)
Insert Color item to the custom colors collection at specified index.
Declaration
public void Insert(int index, Color item)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | Zero-based index at which item should be inserted. |
| System.Drawing.Color | item | The color to insert. |
Load(Stream)
Load content from stream
Declaration
public virtual void Load(Stream s)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | s | Stream object |
Remove(Color)
Remove item from the custom color collection.
Declaration
public bool Remove(Color item)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Color | item | The color to remove. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if item is successfully removed; otherwise, false. |
RemoveAt(Int32)
Removes item from the custom color collection at the specified index.
Declaration
public void RemoveAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | The zero-based index of the element to remove. |
Save(Stream)
Save content to stream
Declaration
public virtual void Save(Stream s)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | s | Stream object |
Serialize(XmlItem)
Serialize to XMLItem
Declaration
public void Serialize(XmlItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| XmlItem | item | XMLItem object |
Events
Changed
Changed handler.
Declaration
public event EventHandler Changed
Event Type
| Type | Description |
|---|---|
| System.EventHandler |