PaletteColors(PaletteID: String): Array;
PaletteColors(PaletteID: string): System.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.
The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components
Imports Prognoz.Platform.Interop.Tab;
Imports Prognoz.Platform.Interop.Drawing;
…
Private Sub comboBox1_SelectedValueChanged(sender: System.Object; e: System.EventArgs);
Var
sp: IVisStyleProvider;
TabSheet: ITabSheet;
count, i, Index: Integer;
Item: object;
PaletteColor: Array Of Integer;
GxColor: GxColorClassClass = New GxColorClassClass();
value: uinteger;
Begin
sp := New VisStyleProvider.Create();
TabSheet := uiTabSheetNet1.TabSheetUi.TabSheet;
Index := comboBox1.SelectedIndex;
Item := comboBox1.Items.Item[Index];
PaletteColor := sp.PaletteColors((Item="default")?"":Item);
For i := 0 To sp.PaletteIDs().Length-1 Do
value := (PaletteColor[i]*-1) As uinteger;
TabSheet.Cell[i,count].Style.BackgroundColor := GxColor.FromValue(value);
End For;
count := count + 1;
End Sub;
See also: