This document is archived and information here might be outdated.  Recommended version.


Move Dockable Window Snippet (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference

Move Dockable Window Snippet

Move a dockable window to a new position.

[C#]
///<summary>Move a dockable window to a new position.</summary>
///  
///<param name="dockableWindow">An IDockableWindow interface.</param>
///<param name="left">A System.Int32 that is the left position of the dockable window from the left screen edge. Example: 10</param>
///<param name="top">A System.Int32 that is the top position of the dockable window from the top screen edge. Example: 10</param>
///   
///<remarks></remarks>
public void MoveDockableWindow(ESRI.ArcGIS.Framework.IDockableWindow dockableWindow, System.Int32 left, System.Int32 top)
{
  if (dockableWindow.IsVisible())
  {
    //Must be floating before calling any IWindowPosition members
    dockableWindow.Dock(ESRI.ArcGIS.Framework.esriDockFlags.esriDockFloat);

    ESRI.ArcGIS.Framework.IWindowPosition windowPosition=dockableWindow as ESRI.ArcGIS.Framework.IWindowPosition;
    windowPosition.Move(left, top, windowPosition.Width, windowPosition.Height);
  }
}
[Visual Basic .NET]
'''<summary>Move a dockable window to a new position.</summary>
'''  
'''<param name="dockableWindow">An IDockableWindow interface.</param>
'''<param name="left">A System.Int32 that is the left position of the dockable window from the left screen edge. Example: 10</param>
'''<param name="top">A System.Int32 that is the top position of the dockable window from the top screen edge. Example: 10</param>
'''   
'''<remarks></remarks>
Public Sub MoveDockableWindow(ByVal dockableWindow As ESRI.ArcGIS.Framework.IDockableWindow, ByVal left As System.Int32, ByVal top As System.Int32)

  If dockableWindow.IsVisible Then

    ' Must be floating before calling any IWindowPosition members
    dockableWindow.Dock(ESRI.ArcGIS.Framework.esriDockFlags.esriDockFloat)
    Dim windowPosition As ESRI.ArcGIS.Framework.IWindowPosition=CType(dockableWindow, ESRI.ArcGIS.Framework.IWindowPosition)
    windowPosition.Move(left, top, windowPosition.Width, windowPosition.Height)
  End If

End Sub

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Framework
  • ESRI.ArcGIS.System