TransWikia.com

Setting DockableWindow Initial Size ArcObjects .NET SDK

Geographic Information Systems Asked by osman on December 16, 2020

In an ArcMap custom tool I used DockableWindow for user interaction. I want to set a size for the window while initial opening. I changed the height and width of InitialPlacement. After changing it looks like this.

  <DockableWindows>
    <DockableWindow id="First_DockableWindow" class="FirstComponent+AddinImpl" caption="First Component" image="Imagesconnected-component.png">
      <InitialPlacement height="600" width="500" state="unpinned" position="left" />
    </DockableWindow>
  </DockableWindows>

I experienced that it ignores the size whatever I set. Did I miss anything?

One Answer

ArcMap caches the position, height, and width of floating and docked windows. I believe what's happening is that caching is overwriting your defaults. Try and delete the The C:Users<user>AppDataRoamingESRIDesktop10.#ArcMapTemplatesnormal.mxt file or the entire ..RoamingESRI and ..LocalEsri folders. You may get the correct default size then.

If you want it to always open at the same size you can fetch the dockable window and set it's height and width like so:

UID dockWinID = new UID();
dockWinID.Value = ThisAddIn.IDs.MyDockId;
dockWindow = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID);
(dockWindow as IWindowPosition).Height = 800;
(dockWindow as IWindowPosition).Width = 150;

Correct answer by danielm on December 16, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP