I build an winforms application in c#.
I'm trying to change the default icons of MSAGL GViewer
component:
but I don't find where to do that.
How can I change them?
GViewer
control uses an old ToolBar
control to show those buttons. To replace those icons, you can find the toolbar in controls collection of the viewer control and set a new ImageList
containing new images for the toolbar:
var toolbar = this.gViewer.Controls["toolbar"] as ToolBar;
toolbar.ImageList = this.imageList1;
The image list should have 18 images in below order. When adding images to image list. After adding images, set the Name
property of image at index 2 to zoom.bmp
because the toolbar use it's name instead of index:
Using above images, and ColorDepth
set to Depth24Bit
and TransparentColor
set to Magenta
here is the final result:
Also as another option you can set ToolBarIsVisible
property of GViewer
component to false
and use your own ToolStrip
or ToolBar
. Then when clicking each button, you can call corresponding method of viewer component, like ZoomInPressed
, ZoomOutPressed
, BackwardButtonPressed
, ForwardButtonPressed
, ... .
Note:
For more information you can take a look at Microsoft Automatic Graph Layout source code repository and source code for GViewer
control.