<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Erik Porter&amp;#39;s Blog : WindowsForms</title><link>http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx</link><description>Tags: WindowsForms</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Messenger-like Window Behavior</title><link>http://weblogs.asp.net/eporter/archive/2004/11/11/256115.aspx</link><pubDate>Fri, 12 Nov 2004 03:54:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:256115</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=256115</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2004/11/11/256115.aspx#comments</comments><description>&lt;p&gt;&lt;font face="Arial" size="2"&gt;I've been finding that more and more of my projects (at work and at home) need to function how Windows (MSN), AOL &amp;amp; Yahoo Messenger work.&amp;nbsp; You know, where you have an icon in the system tray and if you have the application open and&amp;nbsp;hit the minimize button, it minimizes the application just like any other application, but if you click the close button, the form is hidden off of the start bar (almost like it's minimized to the system tray instead).&amp;nbsp; Then you can double click on the icon and have it come right back up.&amp;nbsp; Since this is something pretty similar I could throw together quickly and I think it's a common scenario when writing an application that needs to be open a while, but doesn't need to get in the user's way, I thought I'd write it up and share.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=166c5497-e441-4541-97d1-6b92567746fa"&gt;&lt;font face="Arial" size="2"&gt;http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=166c5497-e441-4541-97d1-6b92567746fa&lt;/font&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;Now, unfortunately, right after uploading to GotDotNet, I noticed, I had forgotten to put a piece of code in there.&amp;nbsp; If you run the app as is from GDN right now and try to shut down your computer, it won't!&amp;nbsp; Good times!&amp;nbsp; The reason is, I'm basically masking the ability to actually close the application and hide it instead, but when Windows tells it to close, since there's no built in way to know what's actually requesting the application to close (like there used to be in VB6 with QueryUnload, but luckily, I believe this feature is back in VS 2005), you have to add a little code to listen for that particular message.&amp;nbsp; To do this, add the following code to the form:&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;&lt;font face="Arial" size="2"&gt;VB&lt;/font&gt;&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;&lt;font size="2"&gt; &lt;p&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;Private&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Const&lt;/font&gt;&lt;font size="2"&gt; WM_QueryEndSession &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Integer&lt;/font&gt;&lt;font size="2"&gt; = &amp;amp;H11&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;Protected&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Overrides&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Sub&lt;/font&gt;&lt;font size="2"&gt; WndProc(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;ByRef&lt;/font&gt;&lt;font size="2"&gt; m &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; Message)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;/font&gt;&lt;font size="2"&gt; m.Msg = WM_QueryEndSession &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;ShouldClose = &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font face="Courier New"&gt;True&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;End&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;MyBase&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;.WndProc(m)&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;End&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Sub&lt;/p&gt;&lt;/font&gt;&lt;/font&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;&lt;font face="Arial" size="2"&gt;C#&lt;/font&gt;&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;&lt;font size="2"&gt; &lt;p&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;private&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;const&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; WM_QueryEndSession = 0x11;&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;protected&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;override&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;font size="2"&gt; WndProc(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;ref&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; Message m)&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; (m.Msg == WM_QueryEndSession)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;shouldClose = &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;true&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;base&lt;/font&gt;&lt;font size="2"&gt;.WndProc(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;ref&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; m);&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;I reposted the corrected code, but unfortunately it hasn't been approved and seems to be taking a lot longer to get approved than the first time!&amp;nbsp; :(&amp;nbsp; So if you download it and the above code isn't in there, put it in there.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;I'm sure everyone reading this blog could figure out how to do all of this themselves, but with such a common, simple task like this, who wants to do it yourself when someone's already done it for you?&amp;nbsp; Enjoy!&amp;nbsp; :)&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=256115" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category><category domain="http://weblogs.asp.net/eporter/archive/tags/Tips/default.aspx">Tips</category></item><item><title>WindowsForms QuickTip: Me.Owner</title><link>http://weblogs.asp.net/eporter/archive/2004/10/04/237631.aspx</link><pubDate>Mon, 04 Oct 2004 20:37:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:237631</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=237631</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2004/10/04/237631.aspx#comments</comments><description>&lt;p&gt;&lt;font face="Arial" size="2"&gt;Want to access the parent form when using ShowDialog to show a form?&amp;nbsp; Consider the following where Form1 is the parent and Form2 is the child to be shown modally.&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt; &lt;p&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; Form2 &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;New&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; Form2&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;Form2.ShowDialog()&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;Form2.Dispose()&lt;/font&gt;&lt;/p&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;If this is in a Button.Click in Form1, this will show Form2 modally from Form1.&amp;nbsp; Now say you need to access Form1 from Form2 to possibly call a Public Method to set it's StatusBar.Text or whatever.&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt; &lt;p&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;DirectCast&lt;/font&gt;&lt;font size="2"&gt;(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Me&lt;/font&gt;&lt;font size="2"&gt;.Owner, Form1).SetStatusBarText("I own you!")&lt;/p&gt;&lt;/font&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;Unfortunately, this doesn't "just work" like I'd expect (maybe you do too).&amp;nbsp; So you can do one of two things to get Owner to return the Form that is showing it modally.&amp;nbsp; Either manually set Form2.Owner = Me before calling ShowDialog or just pass Form1 into ShowDialog like so.&lt;/font&gt;&lt;/p&gt;&lt;font face="Arial" size="2"&gt; &lt;p&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; Form2 &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;New&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; Form2&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;Form2.ShowDialog(&lt;font color="#0000ff"&gt;&lt;em&gt;&lt;strong&gt;Me&lt;/strong&gt;&lt;/em&gt;&lt;/font&gt;)&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;Form2.Dispose()&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;Doing it this way still makes it feels sort of "built-in" in my opinion and allows you to access the parent form without having to setup your own properties.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=237631" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category><category domain="http://weblogs.asp.net/eporter/archive/tags/Tips/default.aspx">Tips</category></item><item><title>WindowsForms ComboBox Auto DropDownList Width</title><link>http://weblogs.asp.net/eporter/archive/2004/09/27/234773.aspx</link><pubDate>Mon, 27 Sep 2004 19:22:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:234773</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=234773</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2004/09/27/234773.aspx#comments</comments><description>&lt;p&gt;&lt;font face="Arial" size="2"&gt;On a project I'm working on, I use some ComboBoxes that act as a breadcrumb control for a Wizard that I wrote, so the user can jump throughout the wizard to different steps easily and understand where they are.&amp;nbsp; Unfortunately, the ComboBoxes are dynamically filled from an admin section and can be anywhere from a few characters to a few hundred characters.&amp;nbsp; This would make the ComboBoxes very wide.&amp;nbsp; Unfortunately, the ComboBox doesn't automatically change the DropDownWidth Property based off of the items in the ComboBox.&amp;nbsp; I went ahead and wrote a Method to do that (This could be added into an inherited ComboBox to be used over and over too if you wanted) and thought I'd share:&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;&lt;strong&gt;&lt;u&gt;VB&lt;/u&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;font face="Arial" size="2"&gt;&lt;font size="2"&gt; &lt;p&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;Private&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Sub&lt;/font&gt;&lt;font size="2"&gt; FindWidthForDropDown(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;ByVal&lt;/font&gt;&lt;font size="2"&gt; ComboBox &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; ComboBox)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; g &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; Graphics = ComboBox.CreateGraphics()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; IsDatabound &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Boolean&lt;/font&gt;&lt;font size="2"&gt; = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Not&lt;/font&gt;&lt;font size="2"&gt; ComboBox.DataSource &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Is&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Nothing&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;AndAlso&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; ComboBox.DisplayMember &amp;lt;&amp;gt; ""&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; WidestWidth &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Integer&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; = ComboBox.DropDownWidth&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; ValueToMeasure &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; CurrentWidth &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Integer&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font size="2"&gt;For&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; i &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Integer&lt;/font&gt;&lt;font size="2"&gt; = 0 &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;To&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; ComboBox.Items.Count - 1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;/font&gt;&lt;font size="2"&gt; IsDatabound &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Then&lt;br /&gt;&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; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;ValueToMeasure = &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;DirectCast&lt;/font&gt;&lt;font size="2"&gt;(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;DirectCast&lt;/font&gt;&lt;font size="2"&gt;(ComboBox.Items(i), DataRowView)(ComboBox.DisplayMember), &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;String&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font face="Courier New"&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&lt;br /&gt;&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; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;ValueToMeasure = &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;DirectCast&lt;/font&gt;&lt;font size="2"&gt;(ComboBox.Items(i), &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;String&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;End&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" color="#0000ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;CurrentWidth = &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;CType&lt;/font&gt;&lt;font size="2"&gt;(g.MeasureString(ValueToMeasure, ComboBox.Font).Width, &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Integer&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;/font&gt;&lt;font size="2"&gt; CurrentWidth &amp;gt; WidestWidth &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Then&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; WidestWidth = CurrentWidth&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font face="Courier New"&gt;Next&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" color="#0000ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;ComboBox.DropDownWidth = WidestWidth&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g.Dispose()&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;End&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Sub&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;&lt;strong&gt;&lt;u&gt;C#&lt;/u&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;font face="Arial" size="2"&gt;&lt;font size="2"&gt; &lt;p&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;private&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font size="2"&gt;void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; findWidthForDropDown(ComboBox comboBox)&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;{&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font size="2"&gt;bool&lt;/font&gt;&lt;font size="2"&gt; isDatabound = comboBox.DataSource != &lt;/font&gt;&lt;font size="2"&gt;null&lt;/font&gt;&lt;font size="2"&gt; &amp;amp;&amp;amp; comboBox.DisplayMember != &lt;/font&gt;&lt;font size="2"&gt;null&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; &amp;amp;&amp;amp; comboBox.DisplayMember != "";&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;int&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; widestWidth = comboBox.DropDownWidth;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; valueToMeasure;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; currentWidth;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#0000ff"&gt;using&lt;/font&gt; (Graphics g = comboBox.CreateGraphics())&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;for&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; i = 0; i &amp;lt; comboBox.Items.Count; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;{&lt;br /&gt;&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; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; (isDatabound)&lt;br /&gt;&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; &lt;/font&gt;&lt;font face="Courier New"&gt;valueToMeasure = (&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;)((DataRowView)comboBox.Items[i])[comboBox.DisplayMember];&lt;br /&gt;&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; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font face="Courier New"&gt;else&lt;br /&gt;&lt;font color="#000000"&gt;&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; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;valueToMeasure = (&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;)ComboBox.Items[i];&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&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; currentWidth = (&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;)g.MeasureString(valueToMeasure, comboBox.Font).Width;&lt;br /&gt;&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; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; (currentWidth &amp;gt; widestWidth) {widestWidth = currentWidth;}&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;comboBox.DropDownWidth = widestWidth;&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;Simple, but hopefully helpful.&amp;nbsp; Just pass in the ComboBox and watch it's DropDownWidth change.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;UPDATE&lt;/font&gt;&lt;/strong&gt;: Check out the comments for some additional things to add to this method suggested by commenter(s).&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=234773" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category><category domain="http://weblogs.asp.net/eporter/archive/tags/Tips/default.aspx">Tips</category></item><item><title>VS-Like TreeView Control and updates</title><link>http://weblogs.asp.net/eporter/archive/2004/09/25/234213.aspx</link><pubDate>Sat, 25 Sep 2004 17:53:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:234213</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=234213</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2004/09/25/234213.aspx#comments</comments><description>&lt;p&gt;&lt;font face="Arial" size="2"&gt;Man oh man I have been out of it.&amp;nbsp; A lot has been going on in my life and it's been over a month since I last blogged.&amp;nbsp; I've been really busy with work and have been doing some writing.&amp;nbsp; I am also now engaged and will be getting married May 28th 2005!&amp;nbsp; Now, no more excuses for why I haven't been blogging and let's get to it!&amp;nbsp; ;)&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;I saw &lt;a href="http://www.codeproject.com/cs/miscctrl/TriStateTreeViewSubmissio.asp"&gt;this very cool control on Code Project&lt;/a&gt; and thought I'd share.&amp;nbsp; It's a 3 state TreeView Control meaning when you check&amp;nbsp;the CheckBox next to a TreeNode it checks all the children and also when unchecking/checking children, if not all children are checked, but some are, the parents back up the chain will display as checked, but grayed out.&amp;nbsp; There were a few things I needed to change to make this control really the way I wanted it to work though and I thought I'd share:&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;&lt;strong&gt;&lt;u&gt;Visual Styles Awareness&lt;/u&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;First problem right off the bat is that the control doesn't support visual styles at all.&amp;nbsp; There are a couple different angles we have to look at to get it to really work correctly.&amp;nbsp; We need to make sure that the current system and it's current theming state allows for visual styles.&amp;nbsp; then, if it does, check to see if the application we're currently running in has them turned on.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;The first bit of code we need to add are some Win32 API calls (The project was already in C# so I just went with it.&amp;nbsp; Where I mention credits below, Cory Smith has a neat VB version).&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt; &lt;p&gt;&lt;font face="Courier New"&gt;[StructLayout(LayoutKind.Sequential)]&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;struct&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; DLLVersionInfo&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; cbSize;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; dwMajorVersion;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; dwMinorVersion;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; dwBuildNumber;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; dwPlatformID;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;[DllImport("user32.dll", CharSet=CharSet.Auto)]&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;private&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;static&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;extern&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; SendMessage(IntPtr hWnd, TreeViewMessages msg, &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; wParam, &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;ref&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; TV_HITTESTINFO lParam);&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;[DllImport("UxTheme.dll", CharSet=CharSet.Auto)]&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;private&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;static&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;extern&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;bool&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; IsAppThemed();&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;[DllImport("UxTheme.dll", CharSet=CharSet.Auto)]&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;private&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;static&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;extern&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;bool&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; IsThemeActive();&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;[DllImport("comctl32.dll", CharSet=CharSet.Auto)]&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;private&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;static&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;extern&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; DllGetVersion(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;ref&lt;/font&gt;&lt;font size="2"&gt; DLLVersionInfo version);&lt;/p&gt;&lt;/font&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;Here's the code needed to wrap it up into a nice little Method.&lt;/font&gt;&lt;/p&gt;&lt;font face="Arial" size="2"&gt;&lt;font size="2"&gt; &lt;p&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;private&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;bool&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; VisualStylesEnabled()&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;OperatingSystem os = Environment.OSVersion;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;bool&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; isAppropriateOS = os.Platform == PlatformID.Win32NT &amp;amp;&amp;amp; ((os.Version.Major == 5 &amp;amp;&amp;amp; os.Version.Minor &amp;gt;= 1) || os.Version.Major &amp;gt; 5);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;bool&lt;/font&gt;&lt;font size="2"&gt; osFeatureThemesPresent = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;false&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;bool&lt;/font&gt;&lt;font size="2"&gt; osThemeDLLAvailable = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;false&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; (isAppropriateOS)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;Version osThemeVersion = OSFeature.Feature.GetVersionPresent(OSFeature.Themes);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;osFeatureThemesPresent = osThemeVersion != &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;DLLVersionInfo dllVersion = &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; DLLVersionInfo();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;dllVersion.cbSize = Marshal.SizeOf(&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;typeof&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;(DLLVersionInfo));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; temp = DllGetVersion(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;ref&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; dllVersion);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;osThemeDLLAvailable = dllVersion.dwMajorVersion &amp;gt;= 6;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#0000ff" size="2"&gt;return&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; isAppropriateOS &amp;amp;&amp;amp; osFeatureThemesPresent &amp;amp;&amp;amp; osThemeDLLAvailable &amp;amp;&amp;amp; IsAppThemed() &amp;amp;&amp;amp; IsThemeActive();&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;Raghavendra Prabhu has a good explanation of each thing to check for in the credits below.&amp;nbsp; &lt;/font&gt;&lt;font face="Arial" size="2"&gt;With all this in place,&amp;nbsp;we can&amp;nbsp;actually add the visual styles to the control.&amp;nbsp; Add a new ImageList to the Component called "m_TriStateImagesXP" (for the sake of following the existing naming convention) and add the following images to it:&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;&lt;a href="http://www.erikporter.com/blog/files/CheckBoxCheckedDisabled.bmp"&gt;Index 0&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.erikporter.com/blog/files/CheckBox.bmp"&gt;Index 1&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.erikporter.com/blog/files/CheckBoxChecked.bmp"&gt;Index 2&lt;/a&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;Now modify the code of the constructor to look like this:&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt; &lt;p&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; TriStateTreeView()&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font face="Courier New"&gt;// This call is required by the Windows.Forms Form Designer.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;InitializeComponent();&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#0000ff"&gt;if&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt; (VisualStylesEnabled())&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;ImageList = m_TriStateImagesXP;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#0000ff"&gt;&lt;font face="Courier New" size="2"&gt;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;ImageList = m_TriStateImages;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;ImageIndex = (&lt;/font&gt;&lt;font face="Courier New" color="#0000ff"&gt;int&lt;/font&gt;&lt;font face="Courier New"&gt;)CheckState.Unchecked;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;SelectedImageIndex = (&lt;/font&gt;&lt;font face="Courier New" color="#0000ff"&gt;int&lt;/font&gt;&lt;font face="Courier New"&gt;)CheckState.Unchecked;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;}&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;Not bad, but luckily, Visual Styles is a lot better integrated in Whidbey.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;Credits &lt;a href="http://blogs.msdn.com/rprabhu/archive/2004/02/15/73443.aspx"&gt;here&lt;/a&gt; and &lt;a href="http://addressof.com/blog/archive/2004/02/15/400.aspx"&gt;here&lt;/a&gt; when I was adding this functionality.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;&lt;strong&gt;&lt;u&gt;AfterCheck Event&lt;/u&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;The AfterCheck Event is one often use in a TreeView and unfortunately doesn't fire off in the provided code.&amp;nbsp; When something doesn't work how you want it to, change it!&amp;nbsp; In my mind, I would only want the AfterCheck Event to fire once for the actual TreeNode that I checked, but you could easily have it fire off for every CheckBox affected as well or possibly make a new Event like AfterInherentCheck or something like that.&amp;nbsp; To add in AfterCheck, add a call to OnAfterCheck in the ChangeNodeState Method, passing in the TreeViewEventArgs.&amp;nbsp; The resulting code looks like this:&lt;/font&gt;&lt;/p&gt;&lt;font face="Arial" size="2"&gt;&lt;font size="2"&gt; &lt;p&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;private&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; ChangeNodeState(TreeNode node)&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;CheckState newState;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;BeginUpdate();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;font size="2"&gt; (node.ImageIndex == (&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;)CheckState.Unchecked || node.ImageIndex &amp;lt; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;newState = CheckState.Checked;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font face="Courier New"&gt;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;newState = CheckState.Unchecked;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;CheckNode(node, newState);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;ChangeParent(node.Parent);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;OnAfterCheck(&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; TreeViewEventArgs(node));&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier New"&gt;EndUpdate();&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;&lt;strong&gt;&lt;u&gt;Cleanup Designer&lt;/u&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;The last thing to do is to take out properties from the designer that are no longer appropriate.&amp;nbsp; Just add the following code to hide them:&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt; &lt;p&gt;&lt;font face="Courier New"&gt;[Browsable(&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;false&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;)]&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;bool&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; CheckBoxes&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;get&lt;/font&gt;&lt;font size="2"&gt; { &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;return&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;base&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;.CheckBoxes; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;set&lt;/font&gt;&lt;font size="2"&gt; { &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;base&lt;/font&gt;&lt;font size="2"&gt;.CheckBoxes = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;value&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;; }&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;[Browsable(&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;false&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;)]&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; ImageIndex&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;get&lt;/font&gt;&lt;font size="2"&gt; { &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;return&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;base&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;.ImageIndex; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;set&lt;/font&gt;&lt;font size="2"&gt; { &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;base&lt;/font&gt;&lt;font size="2"&gt;.ImageIndex = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;value&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;; }&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;[Browsable(&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;false&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;)]&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; ImageList ImageList&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;get&lt;/font&gt;&lt;font size="2"&gt; { &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;return&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;base&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;.ImageList; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;set&lt;/font&gt;&lt;font size="2"&gt; { &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;base&lt;/font&gt;&lt;font size="2"&gt;.ImageList = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;value&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;; }&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New"&gt;[Browsable(&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;false&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;)]&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt; SelectedImageIndex&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;get&lt;/font&gt;&lt;font size="2"&gt; { &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;return&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;base&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;.SelectedImageIndex; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff" size="2"&gt;set&lt;/font&gt;&lt;font size="2"&gt; { &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;base&lt;/font&gt;&lt;font size="2"&gt;.SelectedImageIndex = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;value&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;; }&lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;The end result is something pretty similar to the Visual Studio Tree View control that is aware of Visual Styles.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;UPDATE&lt;/font&gt;&lt;/strong&gt;:&lt;br /&gt;Here are some screen shots at different states:&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/p&gt; &lt;table border="0"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td align="middle"&gt;&lt;font face="Arial" size="2"&gt;&lt;u&gt;&lt;strong&gt;No Theming&lt;/strong&gt;&lt;/u&gt;&lt;/font&gt;&lt;/td&gt; &lt;td align="middle"&gt;&lt;font face="Arial" size="2"&gt;&lt;u&gt;&lt;strong&gt;With Theming&lt;br /&gt;No Visual Styles&lt;/strong&gt;&lt;/u&gt;&lt;/font&gt;&lt;/td&gt; &lt;td align="middle"&gt;&lt;font face="Arial" size="2"&gt;&lt;u&gt;&lt;strong&gt;With Theming&lt;br /&gt;And Visual Styles&lt;/strong&gt;&lt;/u&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td align="middle"&gt;&lt;img src="http://www.erikporter.com/blog/files/TriStateTreeView1.png" /&gt;&lt;/td&gt; &lt;td align="middle"&gt;&lt;img src="http://www.erikporter.com/blog/files/TriStateTreeView2.png" /&gt;&lt;/td&gt; &lt;td align="middle"&gt;&lt;img src="http://www.erikporter.com/blog/files/TriStateTreeView3.png" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=234213" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category><category domain="http://weblogs.asp.net/eporter/archive/tags/Tips/default.aspx">Tips</category></item><item><title>Presentation.IsCompleted = True</title><link>http://weblogs.asp.net/eporter/archive/2004/08/11/213106.aspx</link><pubDate>Thu, 12 Aug 2004 02:55:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:213106</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=213106</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2004/08/11/213106.aspx#comments</comments><description>&lt;p&gt;&lt;font face="Arial" size="2"&gt;Last night I gave &lt;A href="http://weblogs.asp.net/eporter/archive/2004/07/21/190684.aspx"&gt;my presentation&lt;/a&gt; at &lt;a href="http://www.nufw.com/events.aspx?ID=1802ce5e-e95a-4335-a2ff-62241f47c86d"&gt;this month's NUFW Meeting&lt;/a&gt;.&amp;nbsp; As unprepared as I was, I think it went pretty well.&amp;nbsp; Before showing up for the meeting, I had the slides done, but had no demos at all.&amp;nbsp; This actually turned out pretty well.&amp;nbsp; I decided to just do two demos.&amp;nbsp; One was ASP.NET w/ C# and the other was WindowsForms w/ VB.&amp;nbsp; Basically I just played around with both, showed everyone what I could at the time and answered any questions that came up.&amp;nbsp; Originally I had thought that this would be a short presentation since I was not very prepared (time crunch, busy life, etc), but I had to hurry and almost cut the last demo short to keep the meeting under 2 hours!&amp;nbsp; Take this as a hint to never get me talking about all the cool new stuff in VS 2005&amp;nbsp; ;)&amp;nbsp; Event at 2 hours, I felt bad that I didn't really do anyone one section justice, but hopefully everyone there got a good idea about the new stuff coming up!&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Arial" size="2"&gt;Here are &lt;a href="http://www.erikporter.com/temp/WhatsNewDotNet2.zip"&gt;the slides&lt;/a&gt; for anyone interested...sorry there aren't any demos...enjoy!&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=213106" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category><category domain="http://weblogs.asp.net/eporter/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/eporter/archive/tags/General+.NET/default.aspx">General .NET</category><category domain="http://weblogs.asp.net/eporter/archive/tags/Whidbey/default.aspx">Whidbey</category><category domain="http://weblogs.asp.net/eporter/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://weblogs.asp.net/eporter/archive/tags/SQL+Server/default.aspx">SQL Server</category></item><item><title>Setting up the AppUpdater Component to work with Windows Server 2003</title><link>http://weblogs.asp.net/eporter/archive/2004/08/03/206496.aspx</link><pubDate>Tue, 03 Aug 2004 07:51:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:206496</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=206496</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2004/08/03/206496.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;The &lt;A href="http://windowsforms.net/articles/appupdater.aspx"&gt;AppUpdater Component&lt;/A&gt; is sexy.&amp;nbsp; Check out the article on it to get a good start on getting it working.&amp;nbsp; It's a little goofy at first, but works fantastically and is very flexible to fit your needs.&amp;nbsp; For a recent project I did, I set it up to call a WebService to check for updates checking who the user is (a custom forms authentication) and checking a versions database to see what the latest version for that user is.&amp;nbsp; This allows you to do some neat things like have beta versions that only some people get.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;One of the big hurdles I've mentioned before (and have seen other people have problems with) is getting it to work with Windows Server 2003.&amp;nbsp; As we all know it's very locked down from the get go which is great, but sometimes makes it hard to get things working.&amp;nbsp; The following steps will help you setup what you need in IIS 6.0 to get the AppUpdater component to work with a Win2K3 Server:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face=Arial size=2&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial color=#000000 size=2&gt;Open up IIS&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial color=#000000 size=2&gt;Click on the Web Service Extensions node&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial color=#000000 size=2&gt;Click on WebDAV&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial color=#000000 size=2&gt;Click the Allow button&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial color=#000000 size=2&gt;Under Web Sites, navigate to the folder that will hold all the different versions of your applications, in my case, a folder called &amp;#8220;versions&amp;#8220;.&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial color=#000000 size=2&gt;Right mouse click on the &amp;#8220;versions&amp;#8221; folder and click Properties&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial color=#000000 size=2&gt;Click the Create button to make it an IIS Application&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial color=#000000 size=2&gt;Click the Configuration button&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial color=#000000 size=2&gt;Select .config in the application extensions list&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial color=#000000 size=2&gt;Click the Remove button and hit OK&lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial color=#000000 size=2&gt;Check the &amp;#8220;Directory browsing&amp;#8221; checkbox and hit OK&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Hope this helps!&amp;nbsp; :)&amp;nbsp; Again, these instructions are only for the changes necessary for the versions to be housed on a Windows Server 2003 box.&amp;nbsp; For the rest of the &amp;#8220;How-To&amp;#8221; on getting the AppUpdater Component to work, check out the link above.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=206496" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category><category domain="http://weblogs.asp.net/eporter/archive/tags/General+Concepts/default.aspx">General Concepts</category><category domain="http://weblogs.asp.net/eporter/archive/tags/Tips/default.aspx">Tips</category><category domain="http://weblogs.asp.net/eporter/archive/tags/Projects/default.aspx">Projects</category></item><item><title>WindowsForms 2005 Beta 1 ToolBox Problem</title><link>http://weblogs.asp.net/eporter/archive/2004/07/08/177833.aspx</link><pubDate>Fri, 09 Jul 2004 02:42:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:177833</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=177833</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2004/07/08/177833.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Just wanted to let you know that if you can't seem to drag any WindowsForms Controls from the ToolBox onto a Form you're not the only one.&amp;nbsp; I've been having this problem on a couple installs of VS 2005 Beta 1.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Erick Ellis from Microsoft helped us out in the newsgroups and gave this suggestion.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;try deleting &lt;STRONG&gt;toolbox.tbd&lt;/STRONG&gt; from %userprofile%\local settings\application &lt;BR&gt;data\microsoft\visualstudio\8.0\&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;This fixed it, btw...&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=177833" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category><category domain="http://weblogs.asp.net/eporter/archive/tags/Whidbey/default.aspx">Whidbey</category><category domain="http://weblogs.asp.net/eporter/archive/tags/Tips/default.aspx">Tips</category></item><item><title>Overuse of WindowsForms Features</title><link>http://weblogs.asp.net/eporter/archive/2004/06/16/157271.aspx</link><pubDate>Wed, 16 Jun 2004 20:04:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:157271</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=157271</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2004/06/16/157271.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;On my current project, I needed to have a User Control dumped out a variable amount of times in a Panel with AutoScroll set to True.&amp;nbsp; I thought hey, why not just write a loop to add each item to the Panel's Controls Collection and after adding each item set the Dock Property to Top.&amp;nbsp; After that I can do anything I want with spacing, like put some space in between each item.&amp;nbsp; Something like this in my loop seemed to work pretty well.&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face=Arial&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New" color=#0000ff&gt;With&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; Item&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;.Dock = DockStyle.Top&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New" color=#0000ff&gt;With&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; .DockPadding&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;.Left = 4&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;.Right = 4&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;If&lt;/FONT&gt; i &amp;gt; 0 &lt;FONT color=#0000ff&gt;Then&lt;BR&gt;&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; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;.Top = 4&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;If&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;If&lt;/FONT&gt; i &amp;lt;&amp;nbsp;Count - 1 &lt;FONT color=#0000ff&gt;Then&lt;BR&gt;&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; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;.Bottom = 4&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;If&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;With&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;With&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Yes, I'm a perfectionist and accounted for not having any padding above the first item and after the last item.&amp;nbsp; Even though it's only a few pixels, the details can really stand out and &amp;#8220;make the difference&amp;#8221; between a good app and a great app.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;After running it I noticed there was a big problem: The Items were reversed in my Panel.&amp;nbsp; Not good.&amp;nbsp; I'm not sure if this is a bug in WindowsForms (I made sure to add the item to the Controls&amp;nbsp;Collection THEN Dock it and move onto the next Item)&amp;nbsp;or my mistake, but it just didn't work.&amp;nbsp; I figured I could probably set the Top Property of each item to the value of my loop indexer so each item would be one pixel lower than the previous so the docking would work properly, but I'm not a big fan of workarounds.&amp;nbsp; If you make a mistake, don't cover it up, FIX IT!&amp;nbsp; Turns out one line of code will do it (decided worrying about padding on the left and right wasn't necessary):&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face="Courier New" size=2&gt;
&lt;P&gt;Item.Top = (i * Item.Height) + (i * VerticalPadding)&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I originally wanted to stay away from this because it seems hoaky and reminds me of my VB6 days, but damn...1 line doing it manually myself?&amp;nbsp; I'll take that over &amp;#8220;Docking weirdness&amp;#8221; any day.&amp;nbsp; I do love Docking, but it just wasn't right for the job, so I had to send it out the door with a pink slip.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;On a personal note, I'm very excited working on this app.&amp;nbsp; I've mostly done ASP.NET lately and as great as a product as it is, I looooong for a Smart Client!&amp;nbsp; ;)&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=157271" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category><category domain="http://weblogs.asp.net/eporter/archive/tags/Tips/default.aspx">Tips</category></item><item><title>Quick WindowsForms Layout Tip</title><link>http://weblogs.asp.net/eporter/archive/2004/06/14/155188.aspx</link><pubDate>Mon, 14 Jun 2004 18:45:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:155188</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=155188</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2004/06/14/155188.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;This may be categorized under the &amp;#8220;Erik is a big idiot and should've known this&amp;#8221; section and most people probably already know it, but I think it's one of those not so obvious things that may help some people.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;If you've ever dynamically created controls in WindowsForms like filling a Panel with user controls or something along those lines, you may have noticed some really ugly drawing when your form loads.&amp;nbsp; Almost as if it's redrawing every time a control is added.&amp;nbsp; At my last job on my first big project I tried calling the .Hide() Method (on the Panel I'm adding the controls to) before doing anything with the Panel and calling .Show() afterwards.&amp;nbsp; This helped some, but not really.&amp;nbsp; Talking with my bud Jacob Grass about it, he suggested SuspendLayout and ResumeLayout.&amp;nbsp; As soon as he said it I smacked my forehead.&amp;nbsp; If you look in the designer generated code, that's basically what the InitializeComponent Method does for the form; suspends its layout (so the Layout Event isn't fired), adds all the controls to the form and sets them up, then calls ResumeLayout.&amp;nbsp; Changed my code to use those Methods instead anf voila...no constant redrawing and it looks more presentable.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Basically, I would suggest using this the highest most parent when loading.&amp;nbsp; So if you have two Panels with dynamic content, trying using those Methods on the Form they're both on before and after loading.&amp;nbsp; If all you're doing is loading say in one panel, just call them on the Panel before and after loading the controls.&amp;nbsp; Simple tip, but hopefully someone will get&amp;nbsp;a little use out of it.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=155188" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category><category domain="http://weblogs.asp.net/eporter/archive/tags/Tips/default.aspx">Tips</category></item><item><title>No ControlArray's in VS.NET 2005 WindowsForms</title><link>http://weblogs.asp.net/eporter/archive/2004/04/06/108186.aspx</link><pubDate>Tue, 06 Apr 2004 07:30:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:108186</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=108186</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2004/04/06/108186.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Found out today that ControlArray's were taken out of the Alpha version of Whidbey for the Community (2005) Preview.&amp;nbsp; More now than ever, that makes my &lt;A href="http://windowsforms.net/default.aspx?tabindex=4&amp;amp;tabid=47&amp;amp;ItemID=16&amp;amp;mid=142"&gt;ControlArray Component&lt;/A&gt; useful.&amp;nbsp; I've mentioned it before, but check it out if you're doing WindowsForms development and would like a way to logically group controls for event and property aggregation.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I talked with Mike Harsh and some of the other members on the WindowsForms Team today about Designers and how much they've changed from 2003.&amp;nbsp; I'm definitely looking forward to rewriting a VS.NET 2005 version of my ControlArray to take advantage of some of the new designer stuff as well as add functionality, maybe even see if Generics can help me out to get Strongly Typed ControlArrays.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=108186" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category><category domain="http://weblogs.asp.net/eporter/archive/tags/Whidbey/default.aspx">Whidbey</category><category domain="http://weblogs.asp.net/eporter/archive/tags/Projects/default.aspx">Projects</category></item><item><title>Secure Passwords</title><link>http://weblogs.asp.net/eporter/archive/2004/02/18/75951.aspx</link><pubDate>Thu, 19 Feb 2004 04:05:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:75951</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=75951</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2004/02/18/75951.aspx#comments</comments><description>&lt;A href="http://www.dotnetjunkies.com/Tutorial/77D4AFDC-585D-4539-A364-30028327FF14.dcik"&gt;&lt;FONT face=Arial size=2&gt;Well done article&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;, IMO, on securing passwords in a database table.&amp;nbsp; We've been&amp;nbsp;doing this in all of our applications for a while now and it works great.&lt;/FONT&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=75951" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category><category domain="http://weblogs.asp.net/eporter/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/eporter/archive/tags/General+.NET/default.aspx">General .NET</category><category domain="http://weblogs.asp.net/eporter/archive/tags/General+Concepts/default.aspx">General Concepts</category><category domain="http://weblogs.asp.net/eporter/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://weblogs.asp.net/eporter/archive/tags/SQL+Server/default.aspx">SQL Server</category></item><item><title>ControlArray, Collections, etc</title><link>http://weblogs.asp.net/eporter/archive/2004/02/10/71079.aspx</link><pubDate>Wed, 11 Feb 2004 07:19:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:71079</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=71079</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2004/02/10/71079.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Maxim blogs about a ControlArray he's worked on and Collections a few other things &lt;A href="http://ipattern.com/simpleblog/CommentView.aspx?entryid=31"&gt;here&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Thanks for mentioning my ControlArray Component and I'm glad you like it!&amp;nbsp; :)&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=71079" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category></item><item><title>Have your app startup when user logs in</title><link>http://weblogs.asp.net/eporter/archive/2003/12/23/45516.aspx</link><pubDate>Wed, 24 Dec 2003 00:23:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:45516</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=45516</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2003/12/23/45516.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;This is simple, but I thought it was kind of neat.&lt;/FONT&gt;&lt;/P&gt;&lt;FONT color=#0000ff&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;Public&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; &lt;FONT color=#0000ff&gt;Class&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; Common&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color=#0000ff&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Const&lt;/FONT&gt; StartupRegistryFolder &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; = "Software\Microsoft\Windows\CurrentVersion\Run"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color=#0000ff&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Const&lt;/FONT&gt; StartupRegistryKey &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt; = "PSEDesktop"&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color=#0000ff&gt;Public&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Shared&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Property&lt;/FONT&gt; LaunchOnStartup() &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;/FONT&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Boolean&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;Get&lt;BR&gt;&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; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; Key &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt; RegistryKey = Registry.CurrentUser.OpenSubKey(StartupRegistryFolder)&lt;BR&gt;&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; &lt;FONT color=#0000ff&gt;If&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Not&lt;/FONT&gt; Key &lt;FONT color=#0000ff&gt;Is&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Nothing&lt;/FONT&gt; &lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;Then&lt;BR&gt;&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; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; Value &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;String&lt;/FONT&gt; = &lt;FONT color=#0000ff&gt;DirectCast&lt;/FONT&gt;(Key.GetValue(StartupRegistryKey, &lt;FONT color=#0000ff&gt;String&lt;/FONT&gt;.Empty), &lt;FONT color=#0000ff&gt;String&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;)&lt;BR&gt;&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; Key.Close()&lt;BR&gt;&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; &lt;FONT color=#0000ff&gt;Return&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt; Value &amp;lt;&amp;gt; ""&lt;BR&gt;&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; &lt;/FONT&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Else&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;&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; &lt;FONT color=#0000ff&gt;Return&lt;/FONT&gt; &lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;False&lt;BR&gt;&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; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;If&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;Get&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;Set&lt;/FONT&gt;(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; Value &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Boolean&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;)&lt;BR&gt;&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; &lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; Key &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; RegistryKey = Registry.CurrentUser.OpenSubKey(StartupRegistryFolder, &lt;FONT color=#0000ff&gt;True&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;)&lt;BR&gt;&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; &lt;FONT color=#0000ff&gt;If&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Not&lt;/FONT&gt; Key &lt;FONT color=#0000ff&gt;Is&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Nothing&lt;/FONT&gt; &lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;Then&lt;BR&gt;&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; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;If&lt;/FONT&gt; Value &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Then&lt;BR&gt;&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; &lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;Key.SetValue(StartupRegistryKey, Application.ExecutablePath)&lt;BR&gt;&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; &lt;/FONT&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;Else&lt;BR&gt;&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; &lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;Key.DeleteValue(StartupRegistryKey)&lt;BR&gt;&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; &lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;If&lt;BR&gt;&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; &lt;FONT face="Courier New" size=2&gt;&lt;FONT color=#000000&gt;Key.Close()&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&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; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;If&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;Set&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;Property&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Class&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Hopefully someone can find some use for it.&amp;nbsp; Once you have this property in your application somewhere, you can link it to a CheckBox's Checked Property or something like that to let the user decide of they want your application to&amp;nbsp;launch on startup or not.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=45516" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category><category domain="http://weblogs.asp.net/eporter/archive/tags/General+.NET/default.aspx">General .NET</category></item><item><title>WindowsForms Rant</title><link>http://weblogs.asp.net/eporter/archive/2003/12/11/42860.aspx</link><pubDate>Thu, 11 Dec 2003 22:16:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:42860</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=42860</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2003/12/11/42860.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;I don't rant very often, but there are a couple things really getting on my nerves so I figured I'd blog about them and see if anybody knows of any workarounds or maybe feels my pain.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;lt;rant&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;RANT&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;When setting the Focus of a Control in the Form's Load Event, it DOESN'T WORK!&amp;nbsp; Instead I have to go put it in the Activated Event with a Boolean around it to make sure it only calls it once. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Why is it that if I set the ControlBox Property of a Form to False AND set the FormBorderStyle Property to FixedDialog, I can still double click on the title bar of the form and it maximizes it? &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Why is it that if I change the Font of the Form to say....Verdana, the Title Bar's Font doesn't change?&amp;nbsp; BTW, is there some Win32 API I can call to fix that? &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Why are there no good and easy to use Wizard Controls out there?&amp;nbsp; ;)&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;/RANT&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&amp;lt;/rant&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;*Back to work in WindowsForms I go*&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=42860" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category></item><item><title>Cool "VS.NET-like" WindowsForms Controls</title><link>http://weblogs.asp.net/eporter/archive/2003/12/11/42857.aspx</link><pubDate>Thu, 11 Dec 2003 22:06:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:42857</guid><dc:creator>HumanCompiler</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/eporter/rsscomments.aspx?PostID=42857</wfw:commentRss><comments>http://weblogs.asp.net/eporter/archive/2003/12/11/42857.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;I'm sure many of you have already seen these, but those who haven't, &lt;/FONT&gt;&lt;A href="http://www.divil.co.uk/net/controls/"&gt;&lt;FONT face=Arial size=2&gt;check them out&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Tim Dawson made some pretty neato controls.&amp;nbsp; I'm working on a little administration app and I thought it would be cool if it was laid out like Visual Studio .NET, so I went searching and found Tim's controls.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The two I used in particular were the &lt;/FONT&gt;&lt;A href="http://www.divil.co.uk/net/controls/dockingsuite/"&gt;&lt;FONT face=Arial size=2&gt;Docking Suite&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt; and the &lt;/FONT&gt;&lt;A href="http://www.divil.co.uk/net/controls/documentmanager/"&gt;&lt;FONT face=Arial size=2&gt;Document Manager&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The Docking Suite is simple and awesome.&amp;nbsp; Just use the excellent design time support to add some tabs, put in your own controls inside of them and you're done.&amp;nbsp; Then you can do just about everything you can with ToolBars in VS.NET.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The Document Manager has great design time support as well.&amp;nbsp; Unfortunately, IMHO, the object model for it is a bit lacking and doesn't allow you to do much past it without doing some &amp;#8220;workaround&amp;#8221; type stuff, but it looks and works great.&amp;nbsp; An example of something I wanted to do was make it so only one instance of a document could be opened at a time per type of document.&amp;nbsp; There isn't a Documents collection, out in the open which would've been nice.&amp;nbsp; I did however, find a Documents collection under the TabStrip collection, but I guess by default there are technically no TabStrips, so I could never get to it.&amp;nbsp; It was easy to get around though (make an ArrayList to hold the documents and check against it when trying to open a new one, etc).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Overall, fantastic controls!&amp;nbsp; Within 20 minutes, I had a &amp;#8220;VS.NET-like&amp;#8221; WindowsForms app going.&amp;nbsp; Thanks, &lt;A href="http://www.divil.co.uk/net/"&gt;Tim&lt;/A&gt;!&amp;nbsp; :)&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=42857" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/eporter/archive/tags/WindowsForms/default.aspx">WindowsForms</category></item></channel></rss>