Icon on Dockable window tab

871
3
Jump to solution
12-19-2016 02:05 PM
TimSexton1
Occasional Contributor

How do you create an icon on a dockable window's tab when it is docked in the map?  My custom dockable windows have no place that indicates an icon property, yet on all of the ArcMap dockable windows like TOC, Attributes, Catalog and Toolbox have icons on the dockable window's tab when docked.  I want my dockable window to look like the ones attached.

Any ideas?

1 Solution

Accepted Solutions
DuncanHornby
MVP Notable Contributor

I've not used it but I think the Interface you need to be using is IDockableWindowImageDef?

View solution in original post

3 Replies
DuncanHornby
MVP Notable Contributor

I've not used it but I think the Interface you need to be using is IDockableWindowImageDef?

TimSexton1
Occasional Contributor

Thanks, looks like IDockableWindowImageDef is correct, but I'm wondering how to return a Bitmap as an integer using that interface.  Any ideas on why an integer type is used and what the integer refers to?

0 Kudos
TimSexton1
Occasional Contributor

Finally got it working.  I implemented IDockableWindowImageDef as Duncan Hornby recommended by coding the Bitmap property as follows:

        public int Bitmap
        {
            get
            {
                int bitmap = 0;
                try
                {
                    IntPtr hBitmap = Properties.Resources.MyCustomImage.GetHbitmap();
                    bitmap = hBitmap.ToInt32();
                }
                catch { bitmap = 0; }
                
                return bitmap;
            }
        }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍