<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Display legend in dockable window in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/display-legend-in-dockable-window/m-p/385274#M10218</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to display a legend in a dockable window. I am successful in creating a legend in layout view using the code below. Is there anyway to draw 'MSElement' in a dockable window? Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1413316251115737 jive_text_macro" jivemacro_uid="_1413316251115737" modifiedtitle="true"&gt;
&lt;P&gt;ILegend legend = new LegendClass_2();&lt;/P&gt;
&lt;P&gt;legend.AutoAdd = true;&lt;/P&gt;
&lt;P&gt;legend.Title = "Test";&lt;/P&gt;
&lt;P&gt;legend.Map = mxdoc.FocusMap;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;IMapSurroundFrame MSFrame = new MapSurroundFrameClass();&lt;/P&gt;
&lt;P&gt;MSFrame.MapSurround = legend;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;IElement MSElement = MSFrame as IElement;&lt;/P&gt;
&lt;P&gt;IEnvelope en = new EnvelopeClass();&lt;/P&gt;
&lt;P&gt;en.XMin = 1.5; en.YMin = 1.5;&lt;/P&gt;
&lt;P&gt;en.Width = 10; en.Height = 10;&lt;/P&gt;
&lt;P&gt;MSElement.Geometry = en as IGeometry;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;IGraphicsContainer gc = mxdoc.PageLayout as IGraphicsContainer;&lt;/P&gt;
&lt;P&gt;gc.AddElement(MSElement, 0);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;mxdoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphic&lt;/P&gt;
&lt;P&gt;s, null, null);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Oct 2014 19:51:43 GMT</pubDate>
    <dc:creator>JosephSaltenberger</dc:creator>
    <dc:date>2014-10-14T19:51:43Z</dc:date>
    <item>
      <title>Display legend in dockable window</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/display-legend-in-dockable-window/m-p/385274#M10218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to display a legend in a dockable window. I am successful in creating a legend in layout view using the code below. Is there anyway to draw 'MSElement' in a dockable window? Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_1413316251115737 jive_text_macro" jivemacro_uid="_1413316251115737" modifiedtitle="true"&gt;
&lt;P&gt;ILegend legend = new LegendClass_2();&lt;/P&gt;
&lt;P&gt;legend.AutoAdd = true;&lt;/P&gt;
&lt;P&gt;legend.Title = "Test";&lt;/P&gt;
&lt;P&gt;legend.Map = mxdoc.FocusMap;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;IMapSurroundFrame MSFrame = new MapSurroundFrameClass();&lt;/P&gt;
&lt;P&gt;MSFrame.MapSurround = legend;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;IElement MSElement = MSFrame as IElement;&lt;/P&gt;
&lt;P&gt;IEnvelope en = new EnvelopeClass();&lt;/P&gt;
&lt;P&gt;en.XMin = 1.5; en.YMin = 1.5;&lt;/P&gt;
&lt;P&gt;en.Width = 10; en.Height = 10;&lt;/P&gt;
&lt;P&gt;MSElement.Geometry = en as IGeometry;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;IGraphicsContainer gc = mxdoc.PageLayout as IGraphicsContainer;&lt;/P&gt;
&lt;P&gt;gc.AddElement(MSElement, 0);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;mxdoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphic&lt;/P&gt;
&lt;P&gt;s, null, null);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 19:51:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/display-legend-in-dockable-window/m-p/385274#M10218</guid>
      <dc:creator>JosephSaltenberger</dc:creator>
      <dc:date>2014-10-14T19:51:43Z</dc:date>
    </item>
  </channel>
</rss>

