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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change docking icon during run time in WinForms Docking Manager?

Platform: WinForms |
Control: DockingManager |
Published Date: April 30, 2011 |
Last Revised Date: December 6, 2019

Dock icon

DockingManager.SetDockIcon(control,Index number of the ImageList) method can change the icon during runtime.

The following code snippet Change the Icon by changing of Imagelist when button1 click event,

C#

private void button1_Click(object sender, System.EventArgs e)
{
    //Here we Change the Docking Manager ImageList property from
    //ImageList1 to ImageList2 by alternatively
    if(dockingManager1.ImageList==this.imageList2)
       dockingManager1.ImageList=this.imageList1;
    else
       dockingManager1.ImageList=this.imageList2;
}
//Occurs when the ImageList property changes
private void dockingManager1_ImageListChanged(object sender, System.EventArgs e)
{
    //Here the code which set the Docking Icon dynamically.
    dockingManager1.SetDockIcon(this.panel1,0);
    dockingManager1.SetDockIcon(this.panel2,1);
}

 

VB

Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
     'Here we Change the Docking Manager ImageList property from
     'ImageList1 to ImageList2 by alternatively
     If dockingManager1.ImageList Is Me.imageList2 Then
        dockingManager1.ImageList=Me.imageList1
     Else
        dockingManager1.ImageList=Me.imageList2
     End If
End Sub
'Occurs when the ImageList property changes
Private Sub dockingManager1_ImageListChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dockingManager1.ImageListChanged
     'Here the code which set the Docking Icon dynamically.
     dockingManager1.SetDockIcon(Me.panel1,0)
     dockingManager1.SetDockIcon(Me.panel2,1)
End Sub

 

Reference link: https://help.syncfusion.com/windowsforms/dockingmanager/docking-events#imagelistchanged-event

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
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