PaletteColors(PaletteID: String): Array;
PaletteID. Palette identifier.
The PaletteColors method is used to get an array of main main colors by palette identifier.
To get an array of strings with identifiers of alternative palette sets, use the IVisStyleProvider.PaletteIDs method.
Executing the example requires a form that contains the ComboBox component with the ComboBox1 identifier, the UiTabSheet component with the UiTabSheet1 identifier and the TabSheetBox component with the TabSheetBox1 identifier. Specify UiTabSheet1 as a data source for the TabSheetBox1 component. The ComboBox1 component contains a list of styles.
The example is a handler of the OnChange event for the ComboBox1 component.
Add a link to the Drawing system assembly.
Sub ComboBox1OnChange(Sender: Object; Args: IEventArgs);
Var
sp: IVisStyleProvider;
TabSheet: ITabSheet;
count, i, Index: Integer;
Item: String;
PaletteColor: Array Of Integer;
Begin
sp := New VisStyleProvider.Create;
TabSheet := UiTabSheet1.TabSheet;
Index := ComboBox1.ItemIndex;
Item := ComboBox1.Items.Item(Index);
PaletteColor := sp.PaletteColors((Item="default")?"":Item);
For i := 0 To sp.PaletteIDs.Length-1 Do
TabSheet.Cell(i,count).Style.BackgroundColor := GxColor.FromValue(PaletteColor[i]*-1);
End For;
count := count + 1;
End Sub ComboBox1OnChange;
When the style is selected in the ComboBox1 drop-down list, table sheet cells are filled according to the selected style.
See also: