Jon Box's Weblog

 


.NET Articles by the Atomic group

MSDN RDs









Subscribe to "Jon Box's Weblog" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

 

 

  Thursday, February 05, 2004


In the near future, you will hear more about Visual Styles, a cool UI feature in Windows XP.  This feature makes your WinForm applications look professional by doing just a few steps: 1) enable VisualStyles via various mechanisms and 2) set controls with a FlatStyle property to "System".

Enable Visual Styles
In v1.1 of the .NET Framework, you can call EnableVisualStyles like the following:

Public Shared Sub Main()
    Application.EnableVisualStyles()
    Application.DoEvents()
    Application.Run(
New Form1)
End Sub

This usage has issues as some of screens in an app that I did generated strange,sporadic runtime errors.  When I commented the EnableVisualStyles line out, it worked fine.  Some folks also prescribed to add a DoEvents before this as done in the sample.  See http://www.syncfusion.com/faq/winforms/search/1046.asp for other thoughts and an example in C#.   

Due to unsolved strange errors continuing, I finally went away from this and am using a manifest file.  It’s so easy because you just take the below text and put into a file with a name of “YourApp.EXE.Manifest” in your execution directory.  That is all there is to it.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <description>tester</description>
    <dependency>
        <dependentAssembly>
            <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls"  version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df"   language="*" />      
        </dependentAssembly>
    </dependency>
</assembly>

Setting the Controls
Also, don’t forget to change all controls that have a FlatStyle property to the “System” value.  If you do this through the property window, it generates the following:
Me.LabelGreeting.FlatStyle = System.Windows.Forms.FlatStyle.System

Also, check out Mr. Hanselman's thoughts on this.

 


10:48:14 AM    comment []

Another source of technological wonders has entered the blogsphere: JerBear's Lair.  Jerry and I have worked together in Memphis so many times that it requires both of us just to remember the history (including now at Quilogy).  One thing that I know for sure is that Jerry is "smarter than the average bear".  I'm not sure of the exact reason why he is called JerBear (most people don't know about this nickname), but I'm sure that he'll let us know through the blog at some point.  Jerry is a thinker and always looking for a better way to do things.  This will be reflected in his snippets of knowledge.  I know that we'll see thoughts on XML and XSLT on which he is know for around these parts.  As a matter of fact, some of the top rated presenations at the Memphis .NET User Group have been on these subjects and delivered by Mr. JerBear himself.  Jerry also has almost every Microsoft certification known to man, and he is up to date.  So there's so much information in that brain of his, it has to spill out in this blog. Subscribe today!


9:10:52 AM    comment []


Click here to visit the Radio UserLand website. © Copyright 2004 Jon Box.
Last update: 9/1/2004; 12:05:26 AM.

February 2004
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29            
Jan   Mar