<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/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>jfo's coding : Windows Forms</title><link>http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx</link><description>Tags: Windows Forms</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>High DPI - it's an everyone thing.</title><link>http://blogs.msdn.com/jfoscoding/archive/2009/10/11/high-dpi-it-s-an-everyone-thing.aspx</link><pubDate>Sun, 11 Oct 2009 23:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9905955</guid><dc:creator>jfoscoding</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/9905955.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=9905955</wfw:commentRss><description>&lt;P&gt;As larger displays are becoming more popular, they're increasingly being used in places like the livingroom.&amp;nbsp; And if you've ever tried to read text across the room with the default DPI setting, you'll find you&amp;nbsp;may need&amp;nbsp;a pair of opera glasses.&lt;/P&gt;
&lt;P&gt;In Windows 7, if you're using a larger display, the OS will automatically adjust for you, in the hopes that you will be more likely to be able to read text.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;From this we see that there is a real end user benefit to tap into here. It turns out that there is existing infrastructure in Windows called “High DPI” which can be used to address this. High DPI is not a new feature for Windows 7, but it was not until Vista that the OS user-interface made significant investments in support for high DPI (beyond the infrastructure present earlier). To try this out in Vista, rt. Click desktop -&amp;gt; personalize and select “Adjust Font Size (DPI)” from the left hand column. Our thinking for Windows 7 was that if we enable high DPI out of the box on capable displays, we will enable users to have a full-fidelity experience and also significantly reduce eye strain for on-screen reading. There is even infrastructure available to us to detect a display’s native DPI so we can do a better job of configuring default settings out of the box. However, doing this will also open up the door to expose some issues with applications which may not be fully compatible with high DPI configurations. - &lt;A href="http://blogs.msdn.com/e7/archive/2008/09/13/follow-up-on-high-dpi-resolution.aspx" mce_href="http://blogs.msdn.com/e7/archive/2008/09/13/follow-up-on-high-dpi-resolution.aspx"&gt;Engineering Windows 7&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It may be worth a look to see what your app looks like in 120 DPI.&amp;nbsp; In both windows forms and WPF, good use of the AutoSize features usually accomodates most scaling issues.&amp;nbsp; It can be tricky to set up, but once it works, it usually works well.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Windows Forms&lt;/STRONG&gt; lets you set everything in pixels, and then during the loading process, it uses the AutoScale feature to magically multiply whatever you said by however bigger and/or smaller things are supposed to get.&amp;nbsp;How much bigger/smaller things get is best calculated by taking the font size of the Form when you designed it (which is what AutoScaleBaseSize, AutoScaleDimensions are), then taking the new font size as currently run on the system.&amp;nbsp; The percent difference in size is used to adjust the size/location of controls. &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;For windows forms, check out the &lt;/EM&gt;&lt;A href="http://www.windowsclient.net/Samples/Go%20To%20Market/Layout/layoutGTM.doc" mce_href="http://www.windowsclient.net/Samples/Go%20To%20Market/Layout/layoutGTM.doc"&gt;&lt;EM&gt;"AutoScale" section&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt; of this layout FAQ for tips as to how to use AutoScaleDimensions.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;WPF&lt;/STRONG&gt; uses Device Independent Units, which is a fake unit that makes you always think you're drawing in 96DPI.&amp;nbsp; When it goes to render to the screen, it translates the DIU to DPI doing the math under the hood for you.&amp;nbsp;&amp;nbsp;Charles Petzold does a good job explaining &lt;A href="http://www.charlespetzold.com/blog/2005/11/250723.html" mce_href="http://www.charlespetzold.com/blog/2005/11/250723.html"&gt;how the math works&lt;/A&gt;.&amp;nbsp; For the most part this system works well,&amp;nbsp;though you need to know the tricks for&amp;nbsp;&lt;A href="http://blogs.windowsclient.net/makerofthings/archive/2008/05/07/BlurryWPFSilverlight.aspx" mce_href="http://blogs.windowsclient.net/makerofthings/archive/2008/05/07/BlurryWPFSilverlight.aspx"&gt;image rendering and getting lines to draw crisply&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;EM&gt;Note this also means when doing WPF-&amp;gt;Win32 interop, you need to translate back to the device coordinate system.&amp;nbsp; E.g.&amp;nbsp;a WPF button that's set to Width=75, Height=23 is set to 75x23 DIU, not 75x23 pixels.&amp;nbsp; To translate back you can use&amp;nbsp;&lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.media.visual.pointtoscreen.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.windows.media.visual.pointtoscreen.aspx"&gt;Visual.PointToScreen&lt;/A&gt; or&amp;nbsp; &lt;/EM&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.media.compositiontarget.transformtodevice.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.windows.media.compositiontarget.transformtodevice.aspx"&gt;&lt;EM&gt;PresentationSource.FromDependencyObject(dobj).CompositionTarget.TransformToDevice&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;.&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In either system, if you have bitmap artwork in your application, you may want to consider whether or not you want to use a separate larger image for this mode - as in high DPI, the image will be stretched larger.&lt;/P&gt;
&lt;P&gt;If I have any more specific tips, I will be sure to post them!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9905955" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/WPF/default.aspx">WPF</category></item><item><title>Avoiding throwaway layout/painting/mouse code</title><link>http://blogs.msdn.com/jfoscoding/archive/2009/09/08/avoiding-throwaway-layout-painting-mouse-code.aspx</link><pubDate>Tue, 08 Sep 2009 07:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9892385</guid><dc:creator>jfoscoding</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/9892385.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=9892385</wfw:commentRss><description>&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;I’m not normally a Hungarian fanatic or anything, but it is quite easy to create “write once” layout/painting code.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If there’s ever a problem with the math the code needs to be tossed out because it’s too confusing or too difficult to update.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;I think we've all either seen this kind of code and/or have been guilty of writing it at one point... in the interests of reducing frustration for everyone I've got a few tips to&amp;nbsp;write more maintainable UI code.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Label things what they mean&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Instead of:&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Rect r = new Rect(button1.RenderSize);&lt;BR&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Consider something like:&lt;BR&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Rect button1Bounds&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;= new Rect(button1.RenderSize);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;If it’s something not within the button’s coordinate system, then label it by the coordinate system it is in:&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;e.g.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Rect button1BoundsInWindowCoords;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;When creating transforms, consider labelling them in fromTo notation:&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;e.g. &lt;/FONT&gt;&lt;/FONT&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Transform button1ToWindowTransform&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;= button1.TransformToAncestor(window) as Transform;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;This helps you when you’re in the debugger – if you have “t” in your watch window you don’t know which transform you meant when you were writing your code.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I get out a piece of paper and prove the math, and then I verify that my variables are as expected in the debugger.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You can really only use this method if the variables mean something that can’t be changed.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Avoid UI “fudges” if possible.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you must fudge comment it!&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Whenever there’s a fudge, you’re quite likely to be revisiting that code in a few days.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Try to figure out why you need that extra 1PX and put it in a comment next to the code.&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Define reference rectangles and work within them&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;If you only want to do something when something is in the first five pixels of your control, don’t be afraid to create and maintain your own rectangles.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The good thing about reference rectangles is that you can draw them out and see if they are in the right spot.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt; mso-bidi-font-size: 11.0pt"&gt;Rectangle topDropZone = new Rect(0,0,this.Width, 25);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Learn the methods on Rect/Rectangle/Point/Size/Vector&lt;BR&gt;&lt;/B&gt;There are a lot of built in methods that help keep your math tidy.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It’s worth looking at the APIs in some tool or in MSDN to see what can make your life easier.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Here are a few examples from&amp;nbsp;WPF/Silverlight (most are true of System.Drawing as well):&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt; mso-bidi-font-size: 11.0pt"&gt;//Rectangle provides intersection/union methods&lt;BR&gt;if (dropZoneRect.IntersectsWith(someOtherRect)) &lt;BR&gt;Rect selectedArea = rubberBandRect.Intersect(controlBounds);&lt;BR style="mso-special-character: line-break"&gt;&lt;BR style="mso-special-character: line-break"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt; mso-bidi-font-size: 11.0pt"&gt;// Inflate is very handy for increasing the size of a rectangle in all dimensions&lt;BR&gt;Rect borderArea = controlBounds.Inflate(1,1); // x-=1, y-=1, width +=2, height+=2.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt; mso-bidi-font-size: 11.0pt"&gt;// Offset is very handy for adding to X &amp;amp; Y &lt;BR&gt;Point startingLocation = new Point(10,20);&lt;BR&gt;startingLocation.Offset(30,40);&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;// adds 30 to x and 40 to y&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt; mso-bidi-font-size: 11.0pt"&gt;// you can cast a vector to a point or size.&lt;BR&gt;Vector someVector = new Vector(100,20);&lt;BR&gt;Point somePoint = (Point)someVector;&lt;BR&gt;Size someSize = (Size)someVector;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;FONT size=3 face=Calibri&gt;Got any tips?&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9892385" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>How can I remember which order Margin properties are set?</title><link>http://blogs.msdn.com/jfoscoding/archive/2009/09/07/how-can-i-remember-which-order-margin-properties-are-set.aspx</link><pubDate>Tue, 08 Sep 2009 05:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9892366</guid><dc:creator>jfoscoding</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/9892366.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=9892366</wfw:commentRss><description>&lt;P&gt;Often you can stare at a margin property "10,20,30,40" in XAML&amp;nbsp;and be slightly confused as to which is which property.&amp;nbsp; If I have to deal with a format over and over again I will come up with a trick to remember how to work with it.&lt;/P&gt;
&lt;P&gt;My trick is to&amp;nbsp;remembering&amp;nbsp;Thickness/Margin is by saying&amp;nbsp;"LTRB" as in "letter b".&lt;/P&gt;
&lt;P&gt;Example: if we wanted to set the for a button margin&amp;nbsp;like so:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://blogs.msdn.com/jfoscoding/attachment/9892362.ashx" mce_src="http://blogs.msdn.com/jfoscoding/attachment/9892362.ashx"&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Windows Forms&lt;BR&gt;&lt;/STRONG&gt;&amp;nbsp; button.Margin = new Margin(10, 20,30,40); // L,T,R,B&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;WPF/Silverlight&lt;BR&gt;&lt;/STRONG&gt;&amp;nbsp; button.Margin = new Thickness(10,20,30,40); // L,T,R,B&lt;BR&gt;&amp;nbsp; &amp;lt;Button Margin="10,20,30,40"/&amp;gt; &amp;lt;!-- L, T, R, B --&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;CSS&lt;/STRONG&gt;&amp;nbsp;&lt;BR&gt;For completeness, this appears to be different than CSS, which is TRBL or (trouble).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;margin:20px 30px 40px 10px; &lt;/STRONG&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9892366" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>VB6/Winforms interop</title><link>http://blogs.msdn.com/jfoscoding/archive/2006/10/31/vb6-winforms-interop.aspx</link><pubDate>Tue, 31 Oct 2006 20:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:913515</guid><dc:creator>jfoscoding</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/913515.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=913515</wfw:commentRss><description>&lt;P&gt;Check out the &lt;A class="" href="https://www.microsoft.com/downloads/details.aspx?FamilyId=98C38C1D-C630-4D9A-8BB5-7F1FC088A7C4&amp;amp;displaylang=en" mce_href="https://www.microsoft.com/downloads/details.aspx?FamilyId=98C38C1D-C630-4D9A-8BB5-7F1FC088A7C4&amp;amp;displaylang=en"&gt;Microsoft InteropForms Toolkit 1.0&lt;/A&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;This toolkit helps you bring the power of .NET to your existing VB6 applications, by allowing them to display .NET WinForms from within the same application. Instead of upgrading the entire code base, these applications can now be extended one form at a time. The goal is a phased upgrade, with production releases at the end of each iteration containing both VB6 and VB.NET forms running in the same VB6 .exe process.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Screencast available here: &lt;A href="http://blogs.msdn.com/vbteam/archive/2006/09/23/768719.aspx"&gt;http://blogs.msdn.com/vbteam/archive/2006/09/23/768719.aspx&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=913515" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>Josh seems to be having fun with Renderers</title><link>http://blogs.msdn.com/jfoscoding/archive/2006/10/20/josh-seems-to-be-having-fun-with-renderers.aspx</link><pubDate>Fri, 20 Oct 2006 07:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:847409</guid><dc:creator>jfoscoding</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/847409.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=847409</wfw:commentRss><description>&lt;P&gt;It looks like he's put together a very convincing &lt;A class="" href="http://josheinstein.com/journal/archive/2006/10/18/1735.aspx" mce_href="http://josheinstein.com/journal/archive/2006/10/18/1735.aspx"&gt;VistaToolStripRenderer&lt;/A&gt;, and promises a tell-all series of articles.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Stay tuned!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=847409" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>Workaround for disabled flyouts</title><link>http://blogs.msdn.com/jfoscoding/archive/2006/08/10/695048.aspx</link><pubDate>Fri, 11 Aug 2006 06:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:695048</guid><dc:creator>jfoscoding</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/695048.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=695048</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;A href="http://weblogs.asp.net/fbouma/archive/2006/08/10/.NET-2.0_2700_s-ToolStripMenuItem-are-hard-to-disable_2E002E002E00_.aspx"&gt;&lt;FONT face=Tahoma&gt;Frans&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma color=#000000&gt; ran into some trouble disabling parent menu items.&amp;nbsp; Turns out they dont disable the evaluation of child shortcuts.&amp;nbsp;&amp;nbsp;This was an oversight on our part.&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT face=Tahoma color=#000000&gt;That said, most applications remove flyouts that are not in-use so as to not taunt users with menus they can't click on.&amp;nbsp; =)&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT face=Tahoma color=#000000&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT face=Tahoma&gt;&lt;FONT color=#000000&gt;Here's a quick workaround.&amp;nbsp; Add this to your project and replace your ToolStripMenuItems with this type. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT face=Tahoma&gt;&lt;FONT color=#000000&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT face=Tahoma&gt;&lt;FONT color=#000000&gt;Hope this helps!&lt;/FONT&gt;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana color=#000000&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana color=#000000&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;---&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt; System;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt; System.Collections.Generic;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt; System.Text;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;using&lt;/SPAN&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt; System.Windows.Forms;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="COLOR: blue; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;namespace&lt;/SPAN&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt; WindowsApplication51 {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; Workaround for disabled flyout menus still evaluating shortcuts&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;/summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;FullyEnabledMenuItem&lt;/SPAN&gt; : &lt;SPAN style="COLOR: teal"&gt;ToolStripMenuItem&lt;/SPAN&gt; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; ProcessCmdKey(&lt;SPAN style="COLOR: blue"&gt;ref&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;Message&lt;/SPAN&gt; m, &lt;SPAN style="COLOR: teal"&gt;Keys&lt;/SPAN&gt; keyData) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (!IsEveryoneEnabled()) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// store off the current state of enabled-ness&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; isEnabled = Enabled;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.Enabled = &lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// process the shortcut&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; handled = &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;.ProcessCmdKey(&lt;SPAN style="COLOR: blue"&gt;ref&lt;/SPAN&gt; m, keyData);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// restore the state of enabledness&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.Enabled = isEnabled;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&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;&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// return the result of processcmdkey&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; handled;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;else&lt;/SPAN&gt; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// everyone was enabled&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;.ProcessCmdKey(&lt;SPAN style="COLOR: blue"&gt;ref&lt;/SPAN&gt; m, keyData);&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; IsEveryoneEnabled() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (!&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.Enabled) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// walk up the owning item chain until the top&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;ToolStripItem&lt;/SPAN&gt; ownerItem = &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.OwnerItem;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;while&lt;/SPAN&gt; (ownerItem != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (!ownerItem.Enabled) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;ownerItem = ownerItem.OwnerItem;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=695048" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>Win32 Activation and Focus</title><link>http://blogs.msdn.com/jfoscoding/archive/2006/08/02/686141.aspx</link><pubDate>Wed, 02 Aug 2006 09:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:686141</guid><dc:creator>jfoscoding</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/686141.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=686141</wfw:commentRss><description>&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD vAlign=top&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;For the most part, activation and focus work pretty darn well in windows, until you want to tweak something that doesn’t fit within the typical windowing model or roll your own menu. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;Most folks don’t separate out activation and focus, but they are really separate things.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Experimenting for a moment – if you bring up the run dialog (start-&amp;gt;run) and tab over to the cancel button – a dotted rect indicates that the cancel button currently has focus.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This rectangle goes away when you subsequently alt+tab to a different application.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Separately, you may notice that the color of the window goes from dark blue (when the window is active) and light blue (when the window is in-active).&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;With that observation in mind, we could come up with a crude distinction between activation and focus.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;Activation is the currently active top-level window.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;Focus is the control in the system that will receive keyboard input.&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;IMG src="http://blogs.msdn.com/jfoscoding/attachment/686132.ashx"&gt; 
&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;Walkthrough – understanding the interaction of window messages&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;In the run dialog example, I have taken the liberty of capturing some spy++ output.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I picked Spy-&amp;gt;Log Messages, chose “windows of same thread”,&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;dragged the finder tool to the run dialog and checked off the following messages:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/mouseinput/mouseinputreference/mouseinputmessages/wm_mouseactivate.asp"&gt;&lt;FONT face=Verdana size=2&gt;WM_MOUSEACTIVATE&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; – Occurs when someone mouse-s down on an inactive window. Sent to control being activated.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowmessages/wm_ncactivate.asp"&gt;&lt;FONT face=Verdana size=2&gt;WM_NCACTIVATE&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; – Occurs when the non-client area needs to be activated or de-activated (most commonly the title bar changes shades of blue). Sent to the toplevel window.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;A href="http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputmessages/wm_activate.asp?frame=true"&gt;&lt;FONT face=Verdana size=2&gt;WM_ACTIVATE&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt; – Occurs when the client area needs to be activated or deactivated.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Contains information about the other window being activated/deactivated. Sent to the toplevel window.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;A href="http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputmessages/wm_setfocus.asp?frame=true"&gt;&lt;FONT face=Verdana size=2&gt;WM_SETFOCUS&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; – Occurs when setting focus to a control.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Sent to the control itself.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputmessages/wm_killfocus.asp"&gt;&lt;FONT face=Verdana size=2&gt;WM_KILLFOCUS&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; - Occurs when a control is losing focus.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Sent to the control itself.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;I then alt+tab’ed to the run dialog and got the following output:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Lucida Console'"&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Lucida Console'"&gt;&lt;FONT size=2&gt;&amp;lt;00011&amp;gt; 001101DC &lt;?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /&gt;&lt;st1:place w:st="on"&gt;S WM_NCACTIVATE&lt;/st1:place&gt; fActive:True&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Lucida Console'"&gt;&lt;FONT size=2&gt;&amp;lt;00012&amp;gt; 001101DC &lt;st1:place w:st="on"&gt;S WM_ACTIVATE&lt;/st1:place&gt; fActive:WA_ACTIVE fMinimized:False hwndPrevious:(null)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Lucida Console'"&gt;&lt;FONT size=2&gt;&amp;lt;00013&amp;gt; 00080166 &lt;st1:place w:st="on"&gt;S WM_SETFOCUS&lt;/st1:place&gt; hwndLoseFocus:(null)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face=Verdana size=2&gt;00011 – WM_NCACTIVATE: The title bar was previously light blue; this message changes the non-client to be in an active state – the wParam of fActive tells us that the window should become active.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;00012 – WM_ACTIVATE: This message activates the client area of the toplevel window.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The wParam specifies the fActive, and the lParam specifies which other window in the system was previously active.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This handle can be null and will be when the previously active window is not in the same thread.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face=Verdana size=2&gt;00013 – WM_SETFOCUS:&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The cancel button is getting the focus in this case.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;When you get a WM_ACTIVATE, it is usually immediately followed by a WM_SETFOCUS.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;When I alt+tabbed away from the run dialog I got the following output:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Lucida Console'"&gt;&lt;FONT size=2&gt;&amp;lt;00014&amp;gt; 001101DC &lt;st1:place w:st="on"&gt;S WM_NCACTIVATE&lt;/st1:place&gt; fActive:False&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Lucida Console'"&gt;&lt;FONT size=2&gt;&amp;lt;00015&amp;gt; 001101DC &lt;st1:place w:st="on"&gt;S WM_ACTIVATE&lt;/st1:place&gt; fActive:WA_INACTIVE fMinimized:False hwndPrevious:(null)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Lucida Console'"&gt;&lt;FONT size=2&gt;&amp;lt;00016&amp;gt; 00080166 &lt;st1:place w:st="on"&gt;S WM_KILLFOCUS&lt;/st1:place&gt; hwndGetFocus:(null)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face=Verdana size=2&gt;00014 – WM_NCACTIVATE: The title bar is now switching from an active to an in-active state.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face=Verdana size=2&gt;00015 – WM_ACTIVATE: The client area has now lost activation.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Because the window becoming active is outside of the current thread, the handle of the window activating in the wParam is null.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;FONT face=Verdana size=2&gt;00016 – WM_KILLFOCUS: The button has now lost focus.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Because the window getting focus is outside of the current thread, the handle of the control getting focus in the wParam is null.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;Finally I clicked on the run dialog, while it was in-active, and activated it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Lucida Console'"&gt;&lt;o:p&gt;&lt;FONT size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Lucida Console'"&gt;&lt;FONT size=2&gt;&amp;lt;00017&amp;gt; 001101DC &lt;st1:place w:st="on"&gt;S WM_MOUSEACTIVATE&lt;/st1:place&gt; hwndTopLevel:001101DC nHittest:HTCAPTION uMsg:WM_LBUTTONDOWN&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Lucida Console'"&gt;&lt;FONT size=2&gt;&amp;lt;00018&amp;gt; 001101DC &lt;st1:place w:st="on"&gt;S WM_NCACTIVATE&lt;/st1:place&gt; fActive:True&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Lucida Console'"&gt;&lt;FONT size=2&gt;&amp;lt;00019&amp;gt; 001101DC &lt;st1:place w:st="on"&gt;S WM_ACTIVATE&lt;/st1:place&gt; fActive:WA_CLICKACTIVE fMinimized:False hwndPrevious:(null)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;SPAN style="FONT-FAMILY: 'Lucida Console'"&gt;&lt;FONT size=2&gt;&amp;lt;00020&amp;gt; 001501E8 &lt;st1:place w:st="on"&gt;S WM_SETFOCUS&lt;/st1:place&gt; hwndLoseFocus:(null)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;Messages 18-20 are the same as before, but there’s a new message, WM_MOUSEACTIVATE.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This message goes to the control that was clicked on to ask whether it is interested in accepting the mouse down and/or activating the window.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;Some other interesting functions&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;Since a windows message queue is per-thread, a lot of the notion around focus and activation is also per-thread. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/getfocus.asp"&gt;&lt;FONT face=Verdana size=2&gt;GetFocus&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; – returns the handle of the currently focused control on the thread.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A href="http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/setfocus.asp?frame=true"&gt;&lt;FONT face=Verdana size=2&gt;SetFocus&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; – sends a WM_KILLFOCUS to the old control, activates the new window if necessary and sends a WM_SETFOCUS to the new control.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In Windows Forms this is wrapped in the Focus() method.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/getactivewindow.asp"&gt;&lt;FONT face=Verdana size=2&gt;GetActiveWindow&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; – returns the handle of the currently active top-level window within the thread.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A href="http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputfunctions/setactivewindow.asp?frame=true"&gt;&lt;FONT face=Verdana size=2&gt;SetActiveWindow&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; - activates a top-level window within your current thread.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If the application is not in the foreground, it sets what the active window will be.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/getforegroundwindow.asp"&gt;&lt;FONT face=Verdana size=2&gt;GetForegroundWindow&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; – returns the top-level window that is currently active on the desktop.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/setforegroundwindow.asp"&gt;&lt;FONT face=Verdana size=2&gt;SetForegroundWindow&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; – changes the top-level window that is currently active on the desktop.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Not really – &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/setforegroundwindow.asp"&gt;&lt;FONT face=Verdana size=2&gt;see remarks for restrictions&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/oldnewthing/archive/2004/02/16/73780.aspx"&gt;&lt;FONT face=Verdana size=2&gt;And why&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;How can I prevent clicks from activating and focusing my window?&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;You can override the WndProc and handle the WM_MOUSEACTIVATE message.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You can either let the click go through – which is MA_NOACTIVATE, or you can eat the click – which is MA_NOACTIVATEANDEAT.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;A sample of &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/jfoscoding/archive/2005/09/29/475564.aspx"&gt;&lt;FONT face=Verdana size=2&gt;preventing clicks&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; is here.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;How can I prevent my window from getting activation and focus when shown? &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;In Windows Forms 2.0 there is a new property called &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/jfoscoding/archive/2005/09/29/475564.aspx"&gt;&lt;FONT face=Verdana size=2&gt;ShowWithoutActivation&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; – which you would need to override on the Form.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In native applications you can use &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/setwindowpos.asp"&gt;&lt;FONT face=Verdana size=2&gt;SetWindowPos&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt; with the SWP_NOACTIVATE flag or the &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/en-us/winui/winui/WindowsUserInterface/Windowing/Windows/WindowReference/WindowFunctions/ShowWindow.asp?frame=true"&gt;&lt;FONT face=Verdana size=2&gt;ShowWindow&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt; with the SW_SHOWNA flag.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;How can I get focus, but not activation to my window?&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;This is typically a menu-ing situation – you want to show a treeview or something in a popup window.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I’ve talked a bit about the &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/jfoscoding/archive/2005/09/18/471048.aspx"&gt;&lt;FONT face=Verdana size=2&gt;pain and recommendations here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The 2.0 framework supports this, I would recommend starting there rather than rolling your own solution.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=2&gt;&lt;FONT face=Verdana&gt;Best practices with focus and activation (or rather, lessons learned the hard way)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;Avoid manually changing focus when getting and/or losing focus.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This usually proves to be error prone.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Instead look for ways to prevent the focus from changing – preventing activation will usually prevent focus changes.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;Avoid manually changing the active window.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In most cases, it is not possible to activate a window that is not within your process. There are &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/setforegroundwindow.asp"&gt;&lt;FONT face=Verdana size=2&gt;a whole bunch-o-rules in the remarks section&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Verdana size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;The debugger can get in the way of debugging these issues by setting itself as the active window when hitting a breakpoint.&amp;nbsp; Try using &lt;A href="http://blogs.msdn.com/jfoscoding/archive/2006/03/16/553420.aspx"&gt;tracepoints&lt;/A&gt;,&amp;nbsp;Debug.WriteLines or remote debugging.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=686141" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>Rule of thumb for System.Drawing</title><link>http://blogs.msdn.com/jfoscoding/archive/2006/07/25/677944.aspx</link><pubDate>Tue, 25 Jul 2006 18:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:677944</guid><dc:creator>jfoscoding</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/677944.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=677944</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Tahoma&gt;A friend of mine ran into this the other day.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma&gt;If you call a method to get a handle some sort of System.Drawing object, you may be&amp;nbsp;creating an object that needs to be cleaned up through P/Invoke or some other function call.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma&gt;Bitmap.GetHIcon - requires &lt;/FONT&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/ds36fz86.aspx"&gt;&lt;FONT face=Tahoma&gt;p/invoking DestroyIcon&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt;.&lt;BR&gt;Font.ToHFont - &lt;/FONT&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.drawing.font.tohfont.aspx"&gt;&lt;FONT face=Tahoma&gt;requires p/invoking DeleteObject&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;FONT face=Tahoma&gt;Graphics.GetHdc - &lt;/FONT&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/9z5820hw.aspx"&gt;&lt;FONT face=Tahoma&gt;requires calling Graphics.ReleaseHdc&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma&gt;The &lt;A href="http://msdn2.microsoft.com"&gt;MSDN2&lt;/A&gt; documentation seems to be a lot more clear about this, so if you're accessing a handle, you might want to pop over there to see if there are cleanup instructions.&amp;nbsp; You might also consider using the &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/jfoscoding/archive/2005/02/03/366430.aspx"&gt;&lt;FONT face=Tahoma&gt;GDICounter&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt; and reading the background info on &lt;A href="http://blogs.msdn.com/jfoscoding/archive/2005/02/03/366430.aspx"&gt;when to use Dispose&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=677944" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>Tim resurfaces with another control</title><link>http://blogs.msdn.com/jfoscoding/archive/2006/07/23/675866.aspx</link><pubDate>Sun, 23 Jul 2006 20:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:675866</guid><dc:creator>jfoscoding</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/675866.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=675866</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Tahoma&gt;I enjoy talking to Tim Dawson quite a bit; we both know that making the decision to build your own menu is not one to be taken lightly.&amp;nbsp; &lt;/FONT&gt;&lt;A href="http://divil.co.uk/net/controls/sandribbon/"&gt;&lt;FONT face=Tahoma&gt;He's been busy lately&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=675866" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>How do I detect when the WindowState changes?</title><link>http://blogs.msdn.com/jfoscoding/archive/2006/06/23/644336.aspx</link><pubDate>Fri, 23 Jun 2006 17:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:644336</guid><dc:creator>jfoscoding</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/644336.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=644336</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Tahoma&gt;Most of the time, you can get away with checking&amp;nbsp;it in the&amp;nbsp;Form.SizeChanged or Form.Resize event.&amp;nbsp; If you remember, &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/jfoscoding/archive/2005/08/12/450822.aspx"&gt;&lt;FONT face=Tahoma&gt;there's no difference between the two events&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt; so it doesnt matter what you pick.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma&gt;However it was pointed out to me that if you specify a maximum size for your window, this methodology wont work.&amp;nbsp; The actual window message you want to look&amp;nbsp;out for is &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowmessages/wm_size.asp"&gt;&lt;FONT face=Tahoma&gt;WM_SIZE (0x05)&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt;.&amp;nbsp; The wParam of this message gives you details about what's just happened to the window, whether it's been maximized, restored, etc.&amp;nbsp; There is no event that matches this window message, so roll up your sleeves it's WndProc magic hour! [1]&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT face=Tahoma&gt;There are a couple of other window messages that correspond to sizing, which get everyone all confused.&amp;nbsp; WM_WINDOWPOSCHANGING&amp;nbsp;&amp;nbsp;and WM_WINDOWPOSCHANGED occur during the sizing of a control - usually in a response to a call to &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Windows/WindowReference/WindowFunctions/DeferWindowPos.asp"&gt;&lt;FONT face=Tahoma&gt;SetWindowPos&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt;.&amp;nbsp; The most likely place for windows forms to use SetWindowsPos is when you're actually setting Width, Height, Size, Bounds, Location - this usually all funnels to one virtual method called SetBoundsCore (&lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/jfoscoding/archive/2005/09/05/461096.aspx"&gt;&lt;FONT face=Tahoma&gt;which I've mentioned how to debug before&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt;).&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma&gt;There is one window message that sneaks in between the &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowmessages/wm_windowposchanging.asp"&gt;&lt;FONT face=Tahoma&gt;WM_WINDOWPOSCHANGING&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt; (the I'm about to change size message) and the &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowmessages/wm_windowposchanged.asp"&gt;&lt;FONT face=Tahoma&gt;WM_WINDOWPOSCHANGED&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt; (the hey I've changed size message) for toplevel windows - this is WM_GETMINMAXINFO.&amp;nbsp; For toplevel windows with a maximum or minimum size requirement, &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowmessages/wm_getminmaxinfo.asp"&gt;&lt;FONT face=Tahoma&gt;WM_GETMINMAXINFO&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt; is used to apply size restrictions.&amp;nbsp; This is where the Form.MinimumSize and Form.MaximumSize are applied.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma&gt;In my dealings with these window messages, pretty much these are the only ones you'll care about.&amp;nbsp; Everything else in my experience (like WM_MOVE, etc)&amp;nbsp;seems to be syntatic sugar.&lt;/FONT&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma&gt;[1] &lt;STRONG&gt;WndProc Magic hour&lt;/STRONG&gt;:&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Verdana color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; WndProc(&lt;SPAN style="COLOR: blue"&gt;ref&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;Message&lt;/SPAN&gt; m) {&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (m.Msg == &lt;SPAN style="COLOR: green"&gt;/*WM_SIZE*/&lt;/SPAN&gt; 0x0005) {&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&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; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.Text = &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.WindowState.ToString();&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;base&lt;/SPAN&gt;.WndProc(&lt;SPAN style="COLOR: blue"&gt;ref&lt;/SPAN&gt; m);&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=644336" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>Tim shows how to get glass in your client area using Windows Forms</title><link>http://blogs.msdn.com/jfoscoding/archive/2006/04/19/579061.aspx</link><pubDate>Wed, 19 Apr 2006 18:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:579061</guid><dc:creator>jfoscoding</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/579061.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=579061</wfw:commentRss><description>&lt;P&gt;&lt;IMG src="http://www.sneath.org/tim/glassycalendar.png"&gt;&lt;/P&gt;
&lt;P&gt;&lt;A HREF="/tims/archive/2006/04/18/578637.aspx"&gt;&lt;FONT face=Tahoma&gt;Here's how to do it&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt;.&amp;nbsp; (Requires Windows Vista and some willingness to fiddle with how your app paints itself).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=579061" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>ToolStripManager.SaveSettings and UserControls</title><link>http://blogs.msdn.com/jfoscoding/archive/2006/04/12/575121.aspx</link><pubDate>Wed, 12 Apr 2006 20:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:575121</guid><dc:creator>jfoscoding</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/575121.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=575121</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Ingas asks a great question:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;In windows form I have a ToolStripContainer inside a control (inherided from UserControl). I allso have a ToolStripContainer&amp;nbsp; on the main form. I am trying to do ToolStripManager.LoadSettings() (with ToolStripManager.SaveSettings allready done earlier) - supplying the main form. The toolbars on the main form restore their positions, as well as the toolbars that have been moved to the main form by the user. But the toolbars inside the control does not. Is there (or will there be) a method that is fit for the user control?&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;You can use the same SaveSettings and LoadSettings – the problem you’re most likely running into is that SaveSettings and LoadSettings require you to have unique names for all your ToolStripContainers and ToolStrips.&amp;nbsp; If you add a UserControl to your project and drag and drop a ToolStripContainer, it’s very likely that it is named “ToolStripContainer1” – this may clash with the “ToolStripContainer1” that is on your form.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;If you look at what the settings scribbles out (mine was in a hidden directory&amp;nbsp;&lt;FONT face="Courier New"&gt;C:\Documents and Settings\&lt;EM&gt;USERNAME&lt;/EM&gt;\Local Settings\Application Data\Microsoft\WindowsApplication50.vsho_Url_cuxemhukaqqokqln4jqkqtjcvnmlj1iq\1.0.0.0\user.config&lt;/FONT&gt;) [1]&amp;nbsp;you’ll see that the ToolStripManager saves out information based on the names of the items. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;If there are multiple ToolStrips or ToolStripPanels of the same name, the ToolStripManager will just use the first control it finds of the same name.&amp;nbsp; The fix is to ensure you have unique names for *everything* on your form.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;BR&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;IMG src="/jfoscoding/attachment/575121.ashx"&gt; 
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;&lt;STRONG&gt;Here’s how I set up settings that work with a UserControl:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Create a new form.&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Drag &amp;amp; Drop a ToolStrip&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Open the smart tag, choose Insert Standard Items&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Open the smart tag, choose Embed in ToolStripContainer&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Open the smart tag for the ToolStripContainer, choose Dock fill in container&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Create a new user control in the project&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Drag &amp;amp; Drop a ToolStrip&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Click the “new item glinker” to add a few stock images&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Open the smart tag, choose Embed in ToolStripContainer&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Open the smart tag for the ToolStripContainer, choose Dock fill in container&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Important step - rename UserControl1's controls to be unique!&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Rename ToolStrip1 to UserControlToolStrip1&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Rename ToolStripContainer to UserControlToolStripContainer1&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Hook up settings&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Go to the form and add handlers for the Load and FormClosing events.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Write this code&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Form1_Load(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: teal"&gt;EventArgs&lt;/SPAN&gt; e) {&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;ToolStripManager&lt;/SPAN&gt;.LoadSettings(&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Form1_FormClosing(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: teal"&gt;FormClosingEventArgs&lt;/SPAN&gt; e) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;ToolStripManager&lt;/SPAN&gt;.SaveSettings(&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;&lt;STRONG&gt;That’s great but I followed your advice and my ToolStrip disappeared!&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;STRONG&gt;&lt;FONT face=Tahoma&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;How to rename your controls:&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;If you rename your toolstrip or your toolstrip panel and you run the application again, you may notice that your toolstrip disappears.&amp;nbsp; If there is no matching container for your toolstrip, the ToolStripManager assumes that the panel it was in has disappeared and therefore it should not add it.&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;The easiest way to write a “Reset” for your form is to save the settings before calling load…&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;private&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Form1_Load(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: teal"&gt;EventArgs&lt;/SPAN&gt; e) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;ToolStripManager&lt;/SPAN&gt;.SaveSettings(&lt;SPAN style="COLOR: blue"&gt;this,&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;"reset"&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;ToolStripManager&lt;/SPAN&gt;.LoadSettings(&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Reset() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;ToolStripManager&lt;/SPAN&gt;.LoadSettings(&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;, &lt;SPAN style="COLOR: maroon"&gt;"reset"&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;&lt;STRONG&gt;More information&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;Ragha posted &lt;/FONT&gt;&lt;A HREF="/rprabhu/articles/433979.aspx"&gt;&lt;FONT face=Tahoma&gt;some more information&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt; on settings a while back - ToolStripManager uses the same settings APIs to store.&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;There's also information in the &lt;/FONT&gt;&lt;A href="http://www.windowsforms.com/Samples/Go%20To%20Market/Tool%20Strips/ToolStrip%20GTM.doc#_Toc116357041"&gt;&lt;FONT face=Tahoma&gt;ToolStrip FAQ&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt;.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face=Tahoma&gt;[1] Showing the config file for purposes of illustration.&amp;nbsp; One should not directly parse the settings file from disk as there are multiple storage mechanisms for settings.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=575121" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/jfoscoding/attachment/575121.ashx" length="44840" type="image/x-png" /><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>Windows Forms documentation team is blogging </title><link>http://blogs.msdn.com/jfoscoding/archive/2006/03/21/556998.aspx</link><pubDate>Tue, 21 Mar 2006 23:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:556998</guid><dc:creator>jfoscoding</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/556998.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=556998</wfw:commentRss><description>&lt;P dir=ltr&gt;Welcome &lt;A HREF="/winformsue/"&gt;the folks behind the reams and reams of&amp;nbsp;Windows Forms documentation&lt;/A&gt; to the world of blogging!&amp;nbsp; In their own words:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;We're the&amp;nbsp;Windows Forms User Education team at Microsoft. Here you can find updates on documentation related to Windows Forms, ClickOnce, and Smart Client programming months before the documentation is released in new doc builds. Check out what we have to offer, test it out, and give us your feedback if you see something amiss! We want YOUR help in making our documentation set the best it can be. &lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;NOTE&lt;/STRONG&gt;: The updates posted to this site are static. They will not be updated as they become obsolete; we're publishing them merely to give you a "sneak peek" at what&amp;nbsp;we've written that has yet to be released.&amp;nbsp;The latest publicly available build of the documentation should be considered the only official documentation. Any docs provided here are provided as-is, with no express or implied warranty.&lt;/EM&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=556998" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>WM_GETCONTROLNAME</title><link>http://blogs.msdn.com/jfoscoding/archive/2006/03/10/548174.aspx</link><pubDate>Fri, 10 Mar 2006 08:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:548174</guid><dc:creator>jfoscoding</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/548174.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=548174</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Tahoma&gt;Folks quite often ask how to get information about controls from outside the process.&amp;nbsp; In addition to active accessibility (the recommended solution for testing windows forms applications) there's also a handy window message which Control supports called &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/autowforms.asp"&gt;&lt;FONT face=Tahoma&gt;WM_GETCONTROLNAME&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt;.&amp;nbsp;&amp;nbsp;Calling SendMessage with WM_GETCONTROLNAME returns the Control.Name property.&amp;nbsp; Brian McMaster has talked about this special message here, and&amp;nbsp;how to use it&amp;nbsp;with VisualTest.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma&gt;The one giant caveat about using this method is that from outside the process, you need to use &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/creating_named_shared_memory.asp"&gt;&lt;FONT face=Tahoma&gt;shared memory&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt; to make it work as the remarks for &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/messagesandmessagequeues/messagesandmessagequeuesreference/messagesandmessagequeuesfunctions/sendmessage.asp"&gt;SendMessage&lt;/A&gt; point out:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT face=Tahoma&gt;The system only does marshalling for system messages (those in the range 0 to (&lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/en-us/winui/winui/WindowsUserInterface/Windowing/MessagesandMessageQueues/MessagesandMessageQueuesReference/MessagesandMessageQueuesMessages/WM_USER.asp"&gt;&lt;FONT face=Tahoma&gt;WM_USER&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt;-1)). To send other messages (those &amp;gt;= &lt;B&gt;WM_USER&lt;/B&gt;) to another process, you must do custom marshalling.&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;A href="http://msdn.microsoft.com/msdnmag/issues/06/04/ManagedSpy/"&gt;&lt;FONT face=Tahoma&gt;Ben's Managed Spy sample&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma&gt; has sample code for creating memory mapped files, which of course has even richer information returned back for Windows Forms 2.0 forms.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=548174" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>ProfessionalColorTable - what does what?</title><link>http://blogs.msdn.com/jfoscoding/archive/2006/03/08/545942.aspx</link><pubDate>Wed, 08 Mar 2006 09:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:545942</guid><dc:creator>jfoscoding</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/jfoscoding/comments/545942.aspx</comments><wfw:commentRss>http://blogs.msdn.com/jfoscoding/commentrss.aspx?PostID=545942</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Tahoma&gt;If you've read the ToolStrip FAQ, you may already be aware &lt;A href="http://www.windowsforms.com/Samples/Go%20To%20Market/Tool%20Strips/ToolStrip%20GTM.doc#_Toc116357049"&gt;that you can replace the colors of the ToolStrip&lt;/A&gt; by passing in a new ProfessionalColorTable to the constructor of the ToolStripProfessionalRenderer.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma&gt;How can you tell what color does what?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma&gt;Create a form, then add in a property grid and set the SelectedObject to the ProfessionalColorTable.&amp;nbsp; You should be able to see all the colors and descriptions of the colors.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;FONT size=2&gt;&lt;SPAN style="COLOR: teal; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&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;PropertyGrid&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt; pg = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;PropertyGrid&lt;/SPAN&gt;();&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;pg.SelectedObject = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;ProfessionalColorTable&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;pg.Dock = &lt;SPAN style="COLOR: teal"&gt;DockStyle&lt;/SPAN&gt;.Fill;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.0pt; mso-no-proof: yes"&gt;&lt;FONT size=2&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.Controls.Add(pg);&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Tahoma&gt;If you want the same colors as VS, &lt;A HREF="/jfoscoding/archive/2005/11/06/489641.aspx"&gt;that's ground we've already covered&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=545942" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/jfoscoding/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item></channel></rss>