Hi,
I am using ultraStatusBar6.3.1. I am using this status bar to unpin and pin the below section of windows split container. At the moment I am using the pin/unpin custom icon. I need the icon the same like dock-manager pin/unpin icon. Because on different operating system my custom icon remains same while dock-manager and other are changing according to windows theme.
Here the icon in circle needs to be same like dock-manger. Is there any way that I can extract the icon of dock-manager.
You can get the embedded resource stream from the dock assembly with something like this:
typeof(UltraDockManager).Assembly.GetManifestResourceStream("PinButton.ico");
Then you can create an icon from the stream. You may also have to convert it to a Bitmap by calling ToBitmap on the icon.
Thanks for reply,
I have tested you suggested code but it is returning null stream.
My mistake. Either one of these will work instead:
typeof(UltraDockManager).Assembly.GetManifestResourceStream(typeof(UltraDockManager),"PinButton.ico");
typeof(UltraDockManager).Assembly.GetManifestResourceStream("Infragistics.Win.UltraWinDock.PinButton.ico");
I have tried your described solution that is working fine and drawing image. But I need that image should change according to theme of windows at the moment it is drawing only one icon for all windows with red color.
Please tell me how it will change according to windows theme for XP and others.
In that case, you can either use the method Mike Saltzman listed above or you can use the VisualStyleRenderer like this:
VisualStyleRenderer renderer = new VisualStyleRenderer(VisualStyleElement.ExplorerBar.HeaderPin.Normal);renderer.DrawBackground(e.Graphics, new Rectangle(0, 0, 16, 16));
However, this code doesn't scale the image, so it will be a little larger than it is in the dock pane.