<?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 Re: Zoom to Layer refresh not working in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334225#M8729</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Well i tried and to my surprise ... it worked! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thank you very much!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No problem, glad you got it working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duncan and Geoff, here is one thread that illustrates why I added a note of caution:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://stackoverflow.com/questions/5181777/use-of-application-doevents"&gt;http://stackoverflow.com/questions/5181777/use-of-application-doevents&lt;BR /&gt;&lt;BR /&gt;&lt;/A&gt;&lt;SPAN&gt;Like you, I've been using it (sparingly) for years without noticing any negative side effects - I just didn't want the original poster to be caught unaware, in case "the boss" had a vendetta against DoEvents &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Nov 2013 14:36:50 GMT</pubDate>
    <dc:creator>JeffMatson</dc:creator>
    <dc:date>2013-11-22T14:36:50Z</dc:date>
    <item>
      <title>Zoom to Layer refresh not working</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334218#M8722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, what im trying to do is to zoom 2 times, with 3 seconds pause between zooms. &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;public void ZoomToLayerInTOC(ESRI.ArcGIS.ArcMapUI.IMxDocument mxDocument) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (mxDocument == null) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ESRI.ArcGIS.Carto.IActiveView activeView = mxDocument.ActiveView;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the TOC &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ESRI.ArcGIS.ArcMapUI.IContentsView IContentsView = mxDocument.CurrentContentsView; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ESRI.ArcGIS.Geometry.IEnvelope envelope = activeView.Extent; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // ESRI.ArcGIS.Geometry.IEnvelope envelope = activeView.Extent; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; envelope.Expand(0.75, 0.75, true); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; activeView.Extent = envelope; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; activeView.Refresh(); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Threading.Thread.Sleep(3000); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; envelope.Expand(0.75, 0.75, true); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; activeView.Extent = envelope; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; activeView.Refresh(); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Threading.Thread.Sleep(3000); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the selected layer &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Object selectedItem = IContentsView.SelectedItem; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!(selectedItem is ESRI.ArcGIS.Carto.ILayer)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ESRI.ArcGIS.Carto.ILayer layer = selectedItem as ESRI.ArcGIS.Carto.ILayer;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Zoom to the extent of the layer and refresh the map &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; activeView.Extent = layer.AreaOfInterest; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; activeView.Refresh(); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And after clicking button i get zoomed in after 6 seconds. Like there's no refresh after first zoom, although map scrollbars gets smaller.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Nov 2013 20:43:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334218#M8722</guid>
      <dc:creator>DariusDarius</dc:creator>
      <dc:date>2013-11-16T20:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to Layer refresh not working</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334219#M8723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think you might only be able to do this with a timer (which runs on a seperate thread, so beware of threading.)&amp;nbsp; I tried it and looks like the view waits for the processing (sleep) to be finished on the main thread before it redraws.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Nov 2013 14:40:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334219#M8723</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2013-11-19T14:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to Layer refresh not working</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334220#M8724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I think you might only be able to do this with a timer (which runs on a seperate thread, so beware of threading.)&amp;nbsp; I tried it and looks like the view waits for the processing (sleep) to be finished on the main thread before it redraws.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for replying. Well im not really sure what am I supposed to do. I mean I don't know how. By Separate thread you mean create a function? &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Nov 2013 15:20:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334220#M8724</guid>
      <dc:creator>DariusDarius</dc:creator>
      <dc:date>2013-11-19T15:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to Layer refresh not working</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334221#M8725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks for replying. Well im not really sure what am I supposed to do. I mean I don't know how. By Separate thread you mean create a function? &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you tried making a call to Application.DoEvents* in between the first Refresh and the Sleep?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;*warning - many people have strong feelings about using DoEvents&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Nov 2013 16:58:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334221#M8725</guid>
      <dc:creator>JeffMatson</dc:creator>
      <dc:date>2013-11-19T16:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to Layer refresh not working</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334222#M8726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Have you tried making a call to Application.DoEvents* in between the first Refresh and the Sleep?&lt;BR /&gt;&lt;BR /&gt;*warning - many people have strong feelings about using DoEvents&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I use Application.DoEvents all the time in my VB .net applications; love it, usually resolves all those sorts of screen refresh problems and I've never observed any significant slowing down of the application. This is how I would call it in VB.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&lt;SPAN style="color:#000080;"&gt;Dim&lt;/SPAN&gt; App &lt;SPAN style="color:#000080;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color:#000080;"&gt;New&lt;/SPAN&gt; Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase
App.DoEvents()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:50:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334222#M8726</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-12-11T15:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to Layer refresh not working</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334223#M8727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Have you tried making a call to Application.DoEvents* in between the first Refresh and the Sleep?&lt;BR /&gt;&lt;BR /&gt;*warning - many people have strong feelings about using DoEvents&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry to jump in...but could you explain what you mean by people have strong feelings?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just wrote myself a note to test .DoEvents in some of the applications I develop/maintain, but you got me curious. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Nov 2013 21:19:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334223#M8727</guid>
      <dc:creator>deleted-user-VeC5jUIlNXtq</dc:creator>
      <dc:date>2013-11-20T21:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to Layer refresh not working</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334224#M8728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Have you tried making a call to Application.DoEvents* in between the first Refresh and the Sleep?&lt;BR /&gt;&lt;BR /&gt;*warning - many people have strong feelings about using DoEvents&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Well i tried and to my surprise ... it worked! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thank you very much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Nov 2013 16:27:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334224#M8728</guid>
      <dc:creator>DariusDarius</dc:creator>
      <dc:date>2013-11-21T16:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to Layer refresh not working</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334225#M8729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Well i tried and to my surprise ... it worked! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thank you very much!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No problem, glad you got it working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duncan and Geoff, here is one thread that illustrates why I added a note of caution:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://stackoverflow.com/questions/5181777/use-of-application-doevents"&gt;http://stackoverflow.com/questions/5181777/use-of-application-doevents&lt;BR /&gt;&lt;BR /&gt;&lt;/A&gt;&lt;SPAN&gt;Like you, I've been using it (sparingly) for years without noticing any negative side effects - I just didn't want the original poster to be caught unaware, in case "the boss" had a vendetta against DoEvents &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 14:36:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/zoom-to-layer-refresh-not-working/m-p/334225#M8729</guid>
      <dc:creator>JeffMatson</dc:creator>
      <dc:date>2013-11-22T14:36:50Z</dc:date>
    </item>
  </channel>
</rss>

