Category / Section
How do I access the Palettes that are loaded Programmatically using the PaletteGroupBar.LoadPalette()?
2 mins read
Load palettes programmatically
Palettes can be loaded programmatically through the PaletteGroupBar.LoadPalette(). This method returns the instance of PalettegroupView control that holds the palette. Once we have the instance of the palettegroupview control , it can be accessed easily.
This following code snippet shows the above mentioned informations.
C#
//////////////////////////////////////////////////////////////////////////////////////////////////// / * Add the following code snippet to the DiagramBuilder Sample's MainForm_Load() event method * / //////////////////////////////////////////////////////////////////////////////////////////////////// //Create an instance for the PaletteGroupView Class and let the instance hold the reference for the Palettefiles. PaletteGroupView paletteGroupView = this.symbolPaletteGroupBar.LoadPalette(symbolpalettepath + "\\Basic Shapes.edp"); //Set the Back\Fore color for the Palette files of your interest by making use of this PalettegroupView object paletteGroupView.BackColor = Color.Red; paletteGroupView.ForeColor = Color.White; //Set the BorderStyle and Font property of the PaletteFiles paletteGroupView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; paletteGroupView.Font = new Font("Arial",12f,System.Drawing.FontStyle.Bold); //Set the HighlightItemColor property of the PaletteFiles paletteGroupView..HighlightItemColor= Color.YellowGreen;
VB
///////////////////////////////////////////////////////////////////////////////////////////////////// / * Add the following code snippet to the DiagramBuilder Sample's MainForm_Load() event method * / ///////////////////////////////////////////////////////////////////////////////////////////////////// //Create an instance for the PaletteGroupView Class and let the instance hold the reference for the Palettefiles. Private paletteGroupView As Syncfusion.Windows.Forms.Diagram.Controls.PaletteGroupView paletteGroupView = Me.symbolPaletteGroupBar.LoadPalette(symbolpalettepath & "\Basic Shapes.edp") //Set the background color of the Palette files of your interest by making use of this PalettegroupView object paletteGroupView.BackColor = System.Drawing.Color.Red paletteGroupView.Forecolor = System.Drawing.Color.White //Set the BorderStyle and Font property of the PaletteFiles paletteGroupView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle paletteGroupView.Font = New Font("Arial",12f,System.Drawing.FontStyle.Bold) //Set the HighlightItemColor property of the PaletteFiles paletteGroupView.HighlightItemColor= Color.YellowGreen