ArcObjects Library Reference

Open StyleManagerDialog Snippet

Opens the SytleManagerDialog.

[C#]

///<summary>Opens the SytleManagerDialog.</summary>
///<param name="application">An IApplication interface.</param>
///<remarks></remarks>
public void OpenStyleManagerDialog(ESRI.ArcGIS.Framework.IApplication application)
{
  //parameter check
  if (application == null)
  {
    return;
  }

  ESRI.ArcGIS.ArcMapUI.IMxDocument mxDocument = (ESRI.ArcGIS.ArcMapUI.IMxDocument)application.Document; // Explicit Cast 
  ESRI.ArcGIS.Display.IStyleGallery styleGallery = mxDocument.StyleGallery;
  ESRI.ArcGIS.DisplayUI.IStyleDialog styleManagerDialog = new ESRI.ArcGIS.DisplayUI.StyleManagerDialogClass();
  styleManagerDialog.DoModal(styleGallery, application.hWnd);
}
[Visual Basic .NET]

'''<summary>Opens the SytleManagerDialog.</summary>
'''<param name="application">An IApplication interface.</param>
'''<remarks></remarks>
Public Sub OpenStyleManagerDialog(ByVal application As ESRI.ArcGIS.Framework.IApplication)

  'parameter check
  If application Is Nothing Then
    Return
  End If

  Dim mxDocument As ESRI.ArcGIS.ArcMapUI.IMxDocument = CType(application.Document, ESRI.ArcGIS.ArcMapUI.IMxDocument) ' Explicit Cast
  Dim styleGallery As ESRI.ArcGIS.Display.IStyleGallery = mxDocument.StyleGallery
  Dim styleManagerDialog As ESRI.ArcGIS.DisplayUI.IStyleDialog = New ESRI.ArcGIS.DisplayUI.StyleManagerDialogClass()
  styleManagerDialog.DoModal(styleGallery, application.hWnd)

End Sub


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