We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Providing support for loading the palette with the resource file.

Platform: WinForms |
Control: Diagram

Providing support for loading the palette with the resource file.

Syncfusion Diagram supports the functionality of loading the palette with the resource file in PaletteGroupBar. To achieve that functionality the PaletteGroupBar class must be customized and the customized class must inherit PaletteGroupBar Class.

The below code shows how to Customize the PaletteGroupBar class.


class CustomPaletteGroupBar : PaletteGroupBar
        public CustomPaletteGroupBar(): base()


Friend Class CustomPaletteGroupBar
 Inherits PaletteGroupBar
  Public Sub New()
  End Sub
End Class


After customizing the PaletteGroupBar class The LoadPalette method of type PaletteGroupView must be defined.

The below code defines the LoadPalette method.


public PaletteGroupView LoadPalette(Assembly assembly, string baseName, string resName)
            PaletteGroupView paletteView = new PaletteGroupView();
            paletteView.SelectedItem = -1;
            paletteView.EditMode = this.EditMode;
            paletteView.ButtonView = true;
            paletteView.BackColor = Color.Ivory;
            paletteView.Diagram = this.Diagram;
            if (paletteView.LoadPalette(assembly,baseName,resName))
                // Load succeeded.
                GroupBarItem paletteBarItem = new GroupBarItem();
                SymbolPalette symbolPalette = paletteView.Palette;
                paletteBarItem.Text = symbolPalette.Name;
                paletteBarItem.Tag = symbolPalette;
                paletteBarItem.Client = paletteView;
                // Load failed.
                paletteView = null;
            return paletteView;


Public Function LoadPalette(ByVal [assembly] As System.Reflection.Assembly, ByVal baseName As String, ByVal resName As String) As PaletteGroupView
   Dim paletteView As New PaletteGroupView()
   paletteView.SelectedItem = -1
   paletteView.EditMode = Me.EditMode
   paletteView.ButtonView = True
   paletteView.BackColor = Color.Ivory
   paletteView.Diagram = Me.Diagram
   If paletteView.LoadPalette([assembly],baseName,resName) Then
    ' Load succeeded.
    Dim paletteBarItem As New GroupBarItem()
    Dim symbolPalette As SymbolPalette = paletteView.Palette
    paletteBarItem.Text = symbolPalette.Name
    paletteBarItem.Tag = symbolPalette
    paletteBarItem.Client = paletteView
    ' Load failed.
    paletteView = Nothing
   End If
   Return paletteView
End Function


After customizing the PaletteGroupBar class the customized Palettegroupbar class must invoke the LoadPalette method and the resource file is passed as an argument.

The below code shows how to invoke the LoadPalette method and passing the resource file as an argument.


customPaletteGroupBar1.LoadPalette(Assembly.GetExecutingAssembly(), "CustomPalette.Properties.Resources", "Circuit_Shapes");



customPaletteGroupBar1.LoadPalette(System.Reflection.Assembly.GetExecutingAssembly(), "CustomPalette.Properties.Resources", "Circuit_Shapes")


Refer the below attached sample:



2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile