0 Replies Latest reply on Jun 7, 2016 8:08 AM by Vadim Vadim

    How to set size of a feature manager tab icon (custom tab)

    Vadim Vadim

      In SolidWorks 2015 and 2016 (and maybe with earlier versions) it is possible to resize icons of the commands and feature manager pages icons via Customize/Icon size.

      But API allows to define only one icon size for a newly created feature manager window. I use the following code for a new feature manager window creation:

       

                  IModelDoc2 pDoc;

                  pDoc = (IModelDoc2)swAddin.SwApp.IActiveDoc2;

                  IModelViewManager swModelViewMgr;

                  swModelViewMgr = pDoc.ModelViewManager;

                  var elementHost = new System.Windows.Forms.Integration.ElementHost();

                  var projectTreeViewModel = new UI.ViewModels.OpticsManager.OpticsManagerViewModel(swAddin);

                  var projectTree = new OpticsManagerView();

                  projectTree.DataContext = projectTreeViewModel;

                  elementHost.Child = projectTree;

                  swFeatMgrTabTop = swModelViewMgr.CreateFeatureMgrWindowFromHandlex64(swAddin.GetImageFileFromResource("OpticsManagerTabSmall.png"), elementHost.Handle.ToInt64(), OpticsManagerResources.OPTICSMANAGERTAB_TOOLTIP, (int)swFeatMgrPane_e.swFeatMgrPaneBottom);

       

      So with this code I create a feat. manager window with one icon size (usually 16x16). When user uses customization and select some bigger size of icon, two following things happens:

      1. My own feature manager window icon disappears (window must be recreated to get icon back)

      2. Ofter window recreation, the icon is smaller than other SW native icons (because it is 16x16 of course).

       

      So I would like to ask:

      1. How to handle that user changed size of icons via customization

      2. How to define more sizes of the icon (I tried to use icon file with all possible sizes from 16x16 to 64x64, but no effect)