<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: DesignMode + UserControls = HELL!!!</title>
	<atom:link href="http://www.suddenelfilio.net/2007/03/23/designmode-usercontrols-hell/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.suddenelfilio.net/2007/03/23/designmode-usercontrols-hell/</link>
	<description>Passionate about software development</description>
	<lastBuildDate>Tue, 10 Jan 2012 13:58:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Guest</title>
		<link>http://www.suddenelfilio.net/2007/03/23/designmode-usercontrols-hell/comment-page-1/#comment-327</link>
		<dc:creator>Guest</dc:creator>
		<pubDate>Sun, 27 Feb 2011 02:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://suddenelfilio.wordpress.com/2007/03/23/designmode-usercontrols-hell/#comment-327</guid>
		<description>This code seems to work in multiple situations:

protected override void OnHandleCreated(EventArgs e)
{
  base.OnHandleCreated(e);
  if (RunTime())
      MessageBox.Show(&quot;RunTime&quot;, (this.Name + &quot; &quot; + this.GetType().Name).Trim());
  else
    MessageBox.Show(&quot;DesignTime&quot;, (this.Name + &quot; &quot; + this.GetType().Name).Trim());
}

private bool RunTime()
{
  Form parentForm = this.FindForm();
  Control parentControl = this.Parent;
  // Start with highest level and work down.
  if (parentForm != null)
    if (parentForm.Site != null &amp;&amp; parentForm.Site.DesignMode)
      return false;
    else
      return true;
  else if (parentControl != null)
  {
    if (parentControl.Site != null &amp;&amp; parentControl.Site.DesignMode)
      return false;
    else
      return true;
  }
  else if (this.Site != null &amp;&amp; this.Site.DesignMode)
    return false;
  else
    return true;
}
</description>
		<content:encoded><![CDATA[<p>This code seems to work in multiple situations:</p>
<p>protected override void OnHandleCreated(EventArgs e)<br />
{<br />
  base.OnHandleCreated(e);<br />
  if (RunTime())<br />
      MessageBox.Show(&#8220;RunTime&#8221;, (this.Name + &#8221; &#8221; + this.GetType().Name).Trim());<br />
  else<br />
    MessageBox.Show(&#8220;DesignTime&#8221;, (this.Name + &#8221; &#8221; + this.GetType().Name).Trim());<br />
}</p>
<p>private bool RunTime()<br />
{<br />
  Form parentForm = this.FindForm();<br />
  Control parentControl = this.Parent;<br />
  // Start with highest level and work down.<br />
  if (parentForm != null)<br />
    if (parentForm.Site != null &amp;&amp; parentForm.Site.DesignMode)<br />
      return false;<br />
    else<br />
      return true;<br />
  else if (parentControl != null)<br />
  {<br />
    if (parentControl.Site != null &amp;&amp; parentControl.Site.DesignMode)<br />
      return false;<br />
    else<br />
      return true;<br />
  }<br />
  else if (this.Site != null &amp;&amp; this.Site.DesignMode)<br />
    return false;<br />
  else<br />
    return true;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bluewater</title>
		<link>http://www.suddenelfilio.net/2007/03/23/designmode-usercontrols-hell/comment-page-1/#comment-319</link>
		<dc:creator>bluewater</dc:creator>
		<pubDate>Sun, 07 Nov 2010 08:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://suddenelfilio.wordpress.com/2007/03/23/designmode-usercontrols-hell/#comment-319</guid>
		<description>awesome, thx!</description>
		<content:encoded><![CDATA[<p>awesome, thx!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Osmel</title>
		<link>http://www.suddenelfilio.net/2007/03/23/designmode-usercontrols-hell/comment-page-1/#comment-33</link>
		<dc:creator>Osmel</dc:creator>
		<pubDate>Thu, 17 Dec 2009 00:11:52 +0000</pubDate>
		<guid isPermaLink="false">http://suddenelfilio.wordpress.com/2007/03/23/designmode-usercontrols-hell/#comment-33</guid>
		<description>Great tip, huge help! Thanks a lot</description>
		<content:encoded><![CDATA[<p>Great tip, huge help! Thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abel Braaksma</title>
		<link>http://www.suddenelfilio.net/2007/03/23/designmode-usercontrols-hell/comment-page-1/#comment-32</link>
		<dc:creator>Abel Braaksma</dc:creator>
		<pubDate>Wed, 02 Sep 2009 15:28:46 +0000</pubDate>
		<guid isPermaLink="false">http://suddenelfilio.wordpress.com/2007/03/23/designmode-usercontrols-hell/#comment-32</guid>
		<description>The pings above seem to show the intention that LicenseManager.UsageMode is a good workaround. It is for a limited number of situations, but there are too many situations where it fails (to name one: compact framework). One solution that fits all is unfortunately not trivial. You can read about it on my blog, or just download the solution.

http://www.undermyhat.org/blog/2009/07/in-depth-a-definitive-guide-to-net-user-controls-usage-mode-designmode-or-usermode/

-- Abel --</description>
		<content:encoded><![CDATA[<p>The pings above seem to show the intention that LicenseManager.UsageMode is a good workaround. It is for a limited number of situations, but there are too many situations where it fails (to name one: compact framework). One solution that fits all is unfortunately not trivial. You can read about it on my blog, or just download the solution.</p>
<p><a href="http://www.undermyhat.org/blog/2009/07/in-depth-a-definitive-guide-to-net-user-controls-usage-mode-designmode-or-usermode/" rel="nofollow">http://www.undermyhat.org/blog/2009/07/in-depth-a-definitive-guide-to-net-user-controls-usage-mode-designmode-or-usermode/</a></p>
<p>&#8211; Abel &#8211;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Wendelken</title>
		<link>http://www.suddenelfilio.net/2007/03/23/designmode-usercontrols-hell/comment-page-1/#comment-31</link>
		<dc:creator>David Wendelken</dc:creator>
		<pubDate>Mon, 31 Aug 2009 15:13:07 +0000</pubDate>
		<guid isPermaLink="false">http://suddenelfilio.wordpress.com/2007/03/23/designmode-usercontrols-hell/#comment-31</guid>
		<description>Check this link.  Fixed my problem with design mode right away.

http://decav.com/blogs/andre/archive/2007/04/18/1078.aspx</description>
		<content:encoded><![CDATA[<p>Check this link.  Fixed my problem with design mode right away.</p>
<p><a href="http://decav.com/blogs/andre/archive/2007/04/18/1078.aspx" rel="nofollow">http://decav.com/blogs/andre/archive/2007/04/18/1078.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thed</title>
		<link>http://www.suddenelfilio.net/2007/03/23/designmode-usercontrols-hell/comment-page-1/#comment-30</link>
		<dc:creator>thed</dc:creator>
		<pubDate>Fri, 28 Aug 2009 16:30:27 +0000</pubDate>
		<guid isPermaLink="false">http://suddenelfilio.wordpress.com/2007/03/23/designmode-usercontrols-hell/#comment-30</guid>
		<description>Works like a charm. Thanks!</description>
		<content:encoded><![CDATA[<p>Works like a charm. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: In Depth: A definitive guide to .NET user control&#8217;s usage mode: DesignMode or UserMode &#124; Under My Hat</title>
		<link>http://www.suddenelfilio.net/2007/03/23/designmode-usercontrols-hell/comment-page-1/#comment-29</link>
		<dc:creator>In Depth: A definitive guide to .NET user control&#8217;s usage mode: DesignMode or UserMode &#124; Under My Hat</dc:creator>
		<pubDate>Fri, 03 Jul 2009 22:13:45 +0000</pubDate>
		<guid isPermaLink="false">http://suddenelfilio.wordpress.com/2007/03/23/designmode-usercontrols-hell/#comment-29</guid>
		<description>[...] most often mentioned workaround is using the LicenseManager.UsageMode property. From all workarounds I&#8217;ve seen it appears the [...]</description>
		<content:encoded><![CDATA[<p>[...] most often mentioned workaround is using the LicenseManager.UsageMode property. From all workarounds I&#8217;ve seen it appears the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: C#/VB.Net: Knowing what mode you&#8217;re currently executing in &#124; Under My Hat</title>
		<link>http://www.suddenelfilio.net/2007/03/23/designmode-usercontrols-hell/comment-page-1/#comment-28</link>
		<dc:creator>C#/VB.Net: Knowing what mode you&#8217;re currently executing in &#124; Under My Hat</dc:creator>
		<pubDate>Fri, 26 Jun 2009 12:36:17 +0000</pubDate>
		<guid isPermaLink="false">http://suddenelfilio.wordpress.com/2007/03/23/designmode-usercontrols-hell/#comment-28</guid>
		<description>[...] most often mentioned workaround is using the LicenseManager.UsageMode property. From all workarounds I&#8217;ve seen it is the most [...]</description>
		<content:encoded><![CDATA[<p>[...] most often mentioned workaround is using the LicenseManager.UsageMode property. From all workarounds I&#8217;ve seen it is the most [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BillKrat</title>
		<link>http://www.suddenelfilio.net/2007/03/23/designmode-usercontrols-hell/comment-page-1/#comment-27</link>
		<dc:creator>BillKrat</dc:creator>
		<pubDate>Sat, 14 Mar 2009 18:24:16 +0000</pubDate>
		<guid isPermaLink="false">http://suddenelfilio.wordpress.com/2007/03/23/designmode-usercontrols-hell/#comment-27</guid>
		<description>Fix for Mobile Compact Framework (in constructor code) on the following blog:

http://www.global-webnet.net/blogengine/post/2009/03/14/Mobile-Compact-Framework-UserControl-DesignMode-null-in-constructor.aspx</description>
		<content:encoded><![CDATA[<p>Fix for Mobile Compact Framework (in constructor code) on the following blog:</p>
<p><a href="http://www.global-webnet.net/blogengine/post/2009/03/14/Mobile-Compact-Framework-UserControl-DesignMode-null-in-constructor.aspx" rel="nofollow">http://www.global-webnet.net/blogengine/post/2009/03/14/Mobile-Compact-Framework-UserControl-DesignMode-null-in-constructor.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cht</title>
		<link>http://www.suddenelfilio.net/2007/03/23/designmode-usercontrols-hell/comment-page-1/#comment-26</link>
		<dc:creator>cht</dc:creator>
		<pubDate>Tue, 16 Dec 2008 16:39:49 +0000</pubDate>
		<guid isPermaLink="false">http://suddenelfilio.wordpress.com/2007/03/23/designmode-usercontrols-hell/#comment-26</guid>
		<description>helped me al lot, thanks.

cht</description>
		<content:encoded><![CDATA[<p>helped me al lot, thanks.</p>
<p>cht</p>
]]></content:encoded>
	</item>
</channel>
</rss>

