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.
Unfortunately, activation email could not send to your email. Please try again.

How to change Docking Icon during Runtime?

 

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

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

Article ID: Published Date: Last Revised Date: Platform: Control:
1261 04/30/2011 07/10/2014 Windows Forms DockingManager
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.