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


Report Dockable Window Position Snippet (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference

Report Dockable Window Position Snippet

Interrogate if a dockable window is visible, invisible, docked or floating (show position) in a message box.

[C#]
///<summary>Interrogate if a dockable window is visible, invisible, docked or floating (show position) in a message box.</summary>
///  
///<param name="dockableWindow">An IDockableWindow interface.</param>
///   
///<remarks></remarks>
public void ReportDockableWindowPosition(ESRI.ArcGIS.Framework.IDockableWindow dockableWindow)
{
  System.String windowStateMessage=dockableWindow.Caption + " is";
  if (dockableWindow.IsVisible())
  {
    windowStateMessage += " visible";
    ESRI.ArcGIS.Framework.IWindowPosition windowPos=dockableWindow as ESRI.ArcGIS.Framework.IWindowPosition;
    if (windowPos.State == ESRI.ArcGIS.Framework.esriWindowState.esriWSFloating)
    {
      windowStateMessage += " and floating";
      windowStateMessage += string.Format(" (Top: {0}, Left: {1}).", windowPos.Top, windowPos.Left);
    }
    else
    {
      windowStateMessage += " and docked.";
    }
  }
  else
  {
    windowStateMessage += " invisible.";
  }

  System.Windows.Forms.MessageBox.Show(windowStateMessage, "Dockable window state code snippet");
}
[Visual Basic .NET]
'''<summary>Interrogate if a dockable window is visible, invisible, docked or floating (show position) in a message box.</summary>
'''  
'''<param name="dockableWindow">An IDockableWindow interface.</param>
'''   
'''<remarks></remarks>
Public Sub ReportDockableWindowPosition(ByVal dockableWindow As ESRI.ArcGIS.Framework.IDockableWindow)

  Dim windowStateMessage As System.String=dockableWindow.Caption + " is"

  If dockableWindow.IsVisible Then

    windowStateMessage += " visible"
    Dim windowPos As ESRI.ArcGIS.Framework.IWindowPosition=CType(dockableWindow, ESRI.ArcGIS.Framework.IWindowPosition)

    If windowPos.State=ESRI.ArcGIS.Framework.esriWindowState.esriWSFloating Then

      windowStateMessage += " and floating"
      windowStateMessage += String.Format(" (Top: {0}, Left: {1}).", windowPos.Top, windowPos.Left)

    Else

      windowStateMessage += " and docked."

    End If

  Else

    windowStateMessage += " invisible."

  End If

  System.Windows.Forms.MessageBox.Show(windowStateMessage, "Dockable window state code snippet")

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