<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>CanOz Blog</title><link>http://blogs.vbcity.com/canoz/</link><description>Neil Knobbe's Blog at vbCity</description><managingEditor>V. Neil Knobbe</managingEditor><dc:language>en-AU</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>V. Neil Knobbe</dc:creator><title>Reaching the code behind with Windows Presentation Foundation</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/16/9137.aspx</link><pubDate>Wed, 16 Jul 2008 14:58:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/16/9137.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9137.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/16/9137.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9137.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9137.aspx</trackback:ping><description>&lt;P&gt;I mentioned in an &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/06/29/9108.aspx" target=_blank&gt;earlier post &lt;/A&gt;that for a control in a Windows Presentation Foundation (WPF) application that you had to give each control that you wanted to write code behind for a name in the XAML of the form.&lt;/P&gt;
&lt;P&gt;Strictly this is not true.&amp;nbsp; If you want don&amp;#8217;t want to use the built in features of the Visual Studio&amp;#8217;s IDE for selecting classes and methods on the code behind page you could type in the code on the code behind yourself.&lt;/P&gt;
&lt;P&gt;For me, at least, the easiest way to reach the code behind is to give each control a name in the XAML markup&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01codebehind.jpg"&gt;&lt;/P&gt;
&lt;P&gt;then from the code behind page, you can select the control from the dropdown list.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02codebehind.jpg"&gt;&lt;/P&gt;
&lt;P&gt;After you select the control, you have access to all the events associated with the particular control.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/03codebehind.jpg"&gt;&lt;/P&gt;
&lt;P&gt;By selecting a method from the list Visual Studio automatically generates the method declaration for you.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/04codebehind.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Once the declaration is made you can happily enter the necessary code you want for that event.&lt;/P&gt;
&lt;P&gt;If you don&amp;#8217;t want to take advantage of this great feature of Visual Studio, then you can write methods for controls the slightly more difficult way.&lt;/P&gt;
&lt;P&gt;Instead of giving your control a name in the XAML of the form, have toadd an&amp;nbsp;attributes for the control in the XAML.&lt;/P&gt;
&lt;P&gt;The attribute&amp;nbsp;needs to include are the action of the control you want to code against and the name of the method that you will write on the code behind.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/05codebehind.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Once you have added this to the XAML, go to the code behind and declare the method adding the two required parameters of Object and RoutedEventArgs.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/06codebehind.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Then you can add the required code for that method just as you would if you had Visual Studio declare the method for you.&lt;/P&gt;
&lt;P&gt;So there you have it.&amp;nbsp; Two ways to reach the code behind with a Windows Presentation Foundation (WPF) application.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9137.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Setting background colours with Windows Presentation Foundation</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/16/9136.aspx</link><pubDate>Wed, 16 Jul 2008 14:48:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/16/9136.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9136.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/16/9136.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9136.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9136.aspx</trackback:ping><description>&lt;P&gt;I don't think I will ever get over just how much easier it is to do some things in a Windows Presentation Foundation (WPF) application than it is in a Windows application.&lt;/P&gt;
&lt;P&gt;I was messing around with changing the background colour of a button to see what could be done.&amp;nbsp; I ended up looking at how to apply a gradient to be the background of a button and realized that doing gradients with Visual Basic was just about as easy, if not easier, than creating them by modifying XAML markup.&amp;nbsp; (You could also easily create gradients for the background properties of controls in a couple of mouse clicks by using Expression Blend.)&lt;/P&gt;
&lt;P&gt;I started out with a plain button on my Form.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Like all experiments of mine I started off with the basics.&amp;nbsp; I wanted to have a button with a two colour gradient background so I declared a variable as a LinearGradientBrush.&amp;nbsp; (&lt;STRONG&gt;Note&lt;/STRONG&gt; - Now before I hear back from people saying: "You could have declared and set your variable on one line&amp;#8230;" or "You could have just set the Background property&amp;#8230;." ... I know.&amp;nbsp; Due to limitations with taking the screen shots (the screen resolution didn't allow me to get the whole line of code without scrolling or having the code on multiple lines) I wanted everything to be as easy to read as possible.)&lt;/P&gt;The next thing I did was declare the variable as a New LinearGradientBrush and set the parameters which were the starting colour, the finishing colour and the angle that I wanted to gradient to be displayed at.&amp;nbsp; A 0 degree angle shows the gradient from left to right and a 90 degree angle shows the gradients from top to bottom.&amp;nbsp; You can also declare any degree from 0 to 360. (I thought that being able to change the angle of the gradient this easily was a wonderful feature.) 
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Then all that was left was to apply the brush to the background property of the button.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/03backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Run the project and I had the desired effect of a button with a two colour gradient background.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/04backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Now my creative juices started flowing and I got to wondering about having more than two colours in the gradient.&lt;/P&gt;
&lt;P&gt;(&lt;STRONG&gt;Note&lt;/STRONG&gt; - I have apologized in the past for my rather horrible colour matching abilities and I will do so again now and warn those who have not witnessed my graphical abilities to be prepared.)&lt;/P&gt;
&lt;P&gt;Having more than two colours for a gradient background is just as easy as a two colour gradient.&amp;nbsp; One of the overloaded constructors of the LinearGradientBrush is to pass an array of gradient stops as one of the parameters.&lt;/P&gt;
&lt;P&gt;To create the array of gradient stops, you start be declaring and defining variables as New GradientStops.&amp;nbsp; The overloaded constructor for a gradient stop requires that you pass a colour and an offset.&amp;nbsp; (The offset is where the colour is at its full colour in the gradient.&amp;nbsp; The first colour starts at 0 and the last colour ends at 1).&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/05backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;For my button I decided to try three colours and have the colours starting with red on the left then becoming green in the middle and then changing to from green to blue on the right side. &lt;/P&gt;
&lt;P&gt;Next I needed to declare an array to hold the gradient stops in.&amp;nbsp; The type of array that is used for this is a GradientStopCollection and you add the gradient stops to the array by using the Add method.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/06backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;With all the gradient stops in the array/collection, you then set the background of the button as a New LinearGradientBrush and pass the array and an angle for the gradient as parameter to the overloaded new constructor for the brush.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/07backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Now when the project is run, the three colours are displayed on the button.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/08backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;I mentioned the angle parameter of the constructor for the LinearGradientBrush earlier and changing it can lead to some very different looks.&lt;/P&gt;
&lt;P&gt;Using the same code for the three colour button, but changing the angle of the gradient to 45 degrees&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/09backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;the colour change goes from the top left corner of the button to the bottom right.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/10backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;One thing I did notice once I started changing the angle of the gradient I did find that if I wanted the gradient to show evenly I would also have to also change the offset property of the first and middle colours to even out the effect.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/11backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;By changing the offset of the red, there is a little more solid red on before the colour starts mixing with the green.&amp;nbsp; The offset of the green is moved over by .2 as well to keep the green close to the middle of the button.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/12backgroundcolour.jpg"&gt;&lt;/P&gt;
&lt;P&gt;By using the GradientStopCollection adding more colours is a breeze.&amp;nbsp; You just need to create another gradient stop and then add that to the collection.&lt;/P&gt;
&lt;P&gt;As you can see doing gradient colours is now a simple process with Windows Presentation Foundation (WPF) and Visual Basic.NET 2008.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9136.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Project for all VB TabControl content</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/11/9131.aspx</link><pubDate>Fri, 11 Jul 2008 00:36:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/11/9131.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9131.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/11/9131.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9131.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9131.aspx</trackback:ping><description>&lt;P&gt;I have uploaded the project showing how to do all the Tab content which I posted in &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/07/10/9128.aspx" target=_blank&gt;this post&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;The project can be downloaded from &lt;A href="http://www.neilknobbe.com/projects/TabControl_pureVB.zip" target=_blank&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9131.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>TabControl with WPF and Visual Basic.NET 2008 revisited</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/10/9128.aspx</link><pubDate>Thu, 10 Jul 2008 16:25:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/10/9128.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9128.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/10/9128.aspx#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9128.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9128.aspx</trackback:ping><description>&lt;P&gt;When I last visited the TabControl project, I changed it so that the look of the Tab content was done via VB.&amp;nbsp; One thing that has been niggling at me since was how the first Tab content was done.&lt;/P&gt;
&lt;P&gt;The content on the Tab was still entered on the XAML code and the spans were defined there as well so the look could was not really created purely with VB.&amp;nbsp; Since I was after creating the look with VB, the first Tab also be included with this rather than a mixture of XAML and VB.&lt;/P&gt;
&lt;P&gt;I did find that getting the same visual look took a lot more lines of code but, if you were to use the same process on a TextBlock, adding more text in various styles during run time could be done.&lt;/P&gt;
&lt;P&gt;The beginning XAML for the Tab is now very basic with just a Grid on it.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01TabControl_pureVB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;On the code behind starts with declaring variables for both a TextBlock and a Span.&lt;/P&gt;
&lt;P&gt;The textblock is going to be placed inside the grid on the tab and the span is going to end up being the content of the textblock.&lt;/P&gt;Using a span for this is really great.&amp;nbsp; A span is used for grouping a set of different inline content together.&amp;nbsp; Thus allowing several different look to be incorporated in the same span and the really great thing about spans is that they are not inherited so each inline element you add to a span can have its own totally separate look.&amp;nbsp; You don&amp;#8217;t need to get rid of the formatting of the previous element before applying a new formatting. 
&lt;P&gt;The first line I add to the span is going to be in plain text.&amp;nbsp; The text is added by passing the text I want as a Parameter of the Run Class.&amp;nbsp; The run class is an inline content element that may contain either formatter or unformatted text.&amp;nbsp; So basically it is a container for the text I want to add to the span.&lt;/P&gt;
&lt;P&gt;The run is passed into the Add method of the Inlines property.&amp;nbsp; The inlines property is actually a collection of inline elements which make up the span.&lt;/P&gt;From this plain text beginning it is just a matter of declaring a new span for the style that is wanted to be added next, defining the style and adding that span to the inlines collection of the root span. 
&lt;P&gt;One the span is formatted as is wanted, the textblock is added to the grid on the tab and the Span is applied to the inlines property of the textblock.&lt;/P&gt;
&lt;P&gt;Initially I thought that the property of the textblock to apply the span to would have been the text property, but after a little digging I found that because a span is an inline property, it needed to be included in the inline collection of the control.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02TabControl_pureVB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Running the App shows that all the formatting that is set with the code behind is working perfectly.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/03TabControl_pureVB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Thus giving a more pure VB setup of the tab contents.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9128.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Gadget style window with WPF and Visual Basic.NET 2008 Project</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/06/9124.aspx</link><pubDate>Sun, 06 Jul 2008 23:45:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/06/9124.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9124.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/06/9124.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9124.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9124.aspx</trackback:ping><description>&lt;P&gt;I have uploaded the project for the &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/06/29/9108.aspx" target=_blank&gt;Gadget Style Window&lt;/A&gt; with one minor change.&amp;nbsp; Beethoven is out and a small midi file has replaced it.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;I know that some of you are probably saddened as I am by Beethoven's departure, but I didn't want to subject everyone to a 30Mb+ download.&lt;/P&gt;
&lt;P&gt;The project can be downloaded from &lt;A href="http://www.neilknobbe.com/projects/Gadget_VB.zip" target=_blank&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9124.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>TabControl with WPF and XAML Project</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/05/9121.aspx</link><pubDate>Sat, 05 Jul 2008 23:56:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/05/9121.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9121.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/05/9121.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9121.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9121.aspx</trackback:ping><description>&lt;P&gt;I have made the project that goes with the post for the &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/04/12/9029.aspx" target=_blank&gt;TabControl with WPF&lt;/A&gt;&amp;nbsp;available for download.&lt;/P&gt;
&lt;P&gt;The project can be downloaded from &lt;A href="http://www.neilknobbe.com/projects/TabControl_XAML.zip" target=_blank&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Again I must apologise for the file size.&amp;nbsp; Like the project for the &lt;A href="http://www.neilknobbe.com/projects/TabControl_VB.zip" target=_blank&gt;Visual Basic.NET version&lt;/A&gt;&amp;nbsp;of the TabControl it is a little bloated due to the video file.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9121.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>TabControl with WPF and Visual Basic.NET 2008 Project</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/05/9119.aspx</link><pubDate>Sat, 05 Jul 2008 16:44:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/05/9119.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9119.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/05/9119.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9119.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9119.aspx</trackback:ping><description>&lt;P&gt;Sometimes it just takes me a while, but I finally got to the point where I figured I should also be including the Visual Basic projects to go along with the posts and the videos. &lt;/P&gt;
&lt;P&gt;You can download the project that goes along with the &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/07/05/9117.aspx" target=_blank&gt;TabControl with WPF and Visual Basic.NET 2008&lt;/A&gt; post.&lt;/P&gt;
&lt;P&gt;The project can be downloaded from &lt;A href="http://www.neilknobbe.com/projects/TabControl_VB.zip" target=_blank&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;My apologies for the size of the file.&amp;nbsp; It is a little bloated because of having the video file.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9119.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>TabControl with WPF and Visual Basic.NET 2008</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/05/9117.aspx</link><pubDate>Sat, 05 Jul 2008 02:44:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/05/9117.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9117.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/05/9117.aspx#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9117.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9117.aspx</trackback:ping><description>&lt;P&gt;A while back &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/04/12/9029.aspx" target=_blank&gt;I posted up&lt;/A&gt; about showing more interesting content on that tab of a tab control using Windows Presentation Foundation (WPF).&lt;/P&gt;
&lt;P&gt;In the example that I posted, I created the custom look of the tab control just using XAML and I thought that it would be good to also show how to do the same thing using Visual Basic.&lt;/P&gt;
&lt;P&gt;To do this I decided to cut back to the basics for the content of the tabs and I started with a tab control with four tabs.&amp;nbsp; The first tab had a textblock with some text as well as a couple style blocks in it.&amp;nbsp; The second tab starts with a stack panel.&amp;nbsp; The third and fourth tabs have grids on them.&lt;/P&gt;
&lt;P&gt;The XAML for my base project is.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 125pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Window&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Class&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Window1"&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#ff0000&gt; xmlns&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#ff0000&gt; xmlns&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/FONT&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Window1"&lt;/FONT&gt;&lt;/DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#ff0000&gt; Title&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Window1"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Height&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="437"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Width&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="532"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; WindowStartupLocation&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="CenterScreen"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Form1"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabControl&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Tab1"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TextBlock&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Tab1TextBlock"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Span&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Tab1TbSpan1"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Words&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Span&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Span&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Tab1TbSpan2"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;in&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Span&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Span&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Tab1TbSpan3"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Italics&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Span&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TextBlock&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Tab2"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;StackPanel&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Stack"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Orientation&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Horizontal"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;StackPanel&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Tab3"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Grid1"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Grid2"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem.Header&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabItem&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;TabControl&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Window&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;The window does not look too interesting yet,&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01TabControl_VB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;but we will make it look better soon.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Tab 1&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Within the XAML of the text block that is in the first tab, I have added in where I want the different styles to be.&amp;nbsp; I have giving the each span block a name so that it can be referenced by the code behind.&lt;/P&gt;
&lt;P&gt;There are different ways to go about this depending on what you want to do.&amp;nbsp; As you will see I have created one style with several different properties, since I am only going to be setting one property per span block I have only created one new style, or you can create a new style for each span block if you are going to have different styles for overlapping properties.&lt;/P&gt;
&lt;P&gt;I started off by declaring a variable as a New Span, then I set the properties for the variable that I wanted.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 100pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; s &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Span&lt;BR&gt;&lt;BR&gt;s.Foreground = Brushes.Blue&lt;BR&gt;s.FontWeight = FontWeights.Bold&lt;BR&gt;s.FontStyle = FontStyles.Italic&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;Now that I have the properties set, I just need to assign them to the various spans that I have on my tab.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 60pt; BACKGROUND-COLOR: #dcdcdc"&gt;Tab1TbSpan1.Foreground = s.Foreground&lt;BR&gt;Tab1TbSpan2.FontWeight = s.FontWeight&lt;BR&gt;Tab1TbSpan3.FontStyle = s.FontStyle&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;Tab one now has something more elaborate on it.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02TabControl_VB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Admittedly, I could have just used Brushes.Blue to set the Foreground of the first span, but by creating and using a new span I can now re-use this over and over in my code if I wanted to and if I wanted to change the colour, then I would only have to change one line of code rather than possibly having to several to change.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Tab 2&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Tab 2 starts out with a stack panel on it with the orientation of the stack panel set to horizontal.I could have set the orientation of the stack panel with VB code if I wanted by using:&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 40pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;With&lt;/FONT&gt; Stack 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Orientation = Orientation.Horizontal&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;End With&lt;/FONT&gt;&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;if I wanted.&lt;/P&gt;
&lt;P&gt;In the stack panel I am going to place a text block, a rectangle and a circle.&lt;/P&gt;
&lt;P&gt;To add the text block, I need to start out with declaring a new text block then set the Text property.&amp;nbsp; With that done the last line of code adds the text block to the stack panel.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 60pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;With&lt;/FONT&gt; tb &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; TextBlock&lt;BR&gt;&lt;BR&gt;tb.Text = &lt;FONT color=#a31515&gt;"Circles and Rectangles"&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;Stack.Children.Add(tb)&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;I now have a caption on the second tab.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/03TabControl_VB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Next I want to have a circle showing on the tab, so I declare a variable to hold a new ellipse and then set the Height, Width, and Fill.&amp;nbsp; I also set the Margin for the ellipse to a new thickness and pass the numeric representations of left, top, right and bottom to position the ellipse on the tab.&amp;nbsp; Once I have the properties I want set, I add the ellipse to the stack panel.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 90pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; c &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Ellipse&lt;BR&gt;&lt;BR&gt;c.Height = 20&lt;BR&gt;c.Width = 20&lt;BR&gt;c.Fill = Brushes.Blue&lt;BR&gt;c.Margin = &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Thickness(10, 0, 0, 0)&lt;BR&gt;&lt;BR&gt;Stack.Children.Add(c)&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;Tab 2 now has a caption and a circle on it.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/04TabControl_VB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The last item I wanted on the tab was a rectangle, so I did much the same for this as for adding the ellipse.&amp;nbsp; I declared a variable to hold a new rectangle then set the Height, Width and Fill.&amp;nbsp; Again I set the margin property to a new thickness to position the rectangle on the tab.&amp;nbsp; Then I added the rectangle to the stack panel.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 90pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; r &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Rectangle&lt;BR&gt;&lt;BR&gt;r.Height = 15&lt;BR&gt;r.Width = 25&lt;BR&gt;r.Fill = Brushes.Red&lt;BR&gt;r.Margin = &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Thickness(10, 0, 0, 0)&lt;BR&gt;&lt;BR&gt;Stack.Children.Add(r)&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;I now have my desired look for the second tab.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/05TabControl_VB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Tab 3&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;Tab 3 will hold an image.&lt;/P&gt;
&lt;P&gt;Once again I start off by declaring a variable which will hold a new image, then set the Width and Source properties.The source property is declared as a New BitmapImage and the path of the image file, as well as what kind of Uri the path is, are passed as parameters of the Uri of the file.&amp;nbsp; The image control is then added to the grid on the tab.&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 70pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; v &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Image&lt;BR&gt;&lt;BR&gt;v.Width = 80&lt;BR&gt;v.Source = &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; BitmapImage(&lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Uri(&lt;FONT color=#a31515&gt;"Lizard004_RJ.JPG"&lt;/FONT&gt;, UriKind.Relative))&lt;BR&gt;&lt;BR&gt;Grid1.Children.Add(v)&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;The third tab now displays an image.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/06TabControl_VB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Tab 4&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The last tab on my tab control is going to display a video.&lt;/P&gt;
&lt;P&gt;I start out by declaring a variable to hold a new instance of a media element, then set the Width and Source properties of the element before adding the control to the grid on the fourth tab. &lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 60pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; m &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; MediaElement&lt;BR&gt;&lt;BR&gt;m.Width = 80&lt;BR&gt;m.Source = &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Uri(&lt;FONT color=#a31515&gt;"butterfly.wmv"&lt;/FONT&gt;, UriKind.Relative)&lt;BR&gt;&lt;BR&gt;Grid2.Children.Add(m)&lt;BR&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;The tab now displays the video and completes the effect I was after.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/07TabControl_VB.jpg"&gt;&lt;/P&gt;
&lt;P&gt;So you can see that it can be just as easy to do in Visual Basic what you can with XAML.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9117.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Video for Gadget Window</title><link>http://blogs.vbcity.com/canoz/archive/2008/07/02/9113.aspx</link><pubDate>Wed, 02 Jul 2008 12:15:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/07/02/9113.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9113.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/07/02/9113.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9113.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9113.aspx</trackback:ping><description>&lt;P&gt;I have finished the video showing the process for creating a Gadget Style window.&lt;/P&gt;
&lt;P&gt;You can download it from &lt;A href="http://www.neilknobbe.com/videos/gadget.zip"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9113.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Creating a Gadget style window with WPF and Visual Basic.NET 2008</title><link>http://blogs.vbcity.com/canoz/archive/2008/06/29/9108.aspx</link><pubDate>Sun, 29 Jun 2008 05:03:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/06/29/9108.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9108.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/06/29/9108.aspx#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9108.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9108.aspx</trackback:ping><description>&lt;P&gt;I don&amp;#8217;t know if it is a case of my actually knowing more or the fact that doing stuff with Windows Presentation Foundation (WPF) is easier.&amp;nbsp; To me it seems doing what I want is getting quicker these days.&lt;/P&gt;
&lt;P&gt;The ability to create and use semi-transparent forms has been around for a while now, but the process to creating these types of forms has not been the easiest.&lt;/P&gt;
&lt;P&gt;Visual Basic.NET 2005 gave us access to the opacity property of a Windows form.&amp;nbsp; The down side of this was that it made the whole form, including any controls on the form, opaque thus still showing some of the form itself.&lt;/P&gt;
&lt;P&gt;With very little code, creating a gadget type window with WPF is relatively easy.&amp;nbsp; In fact look of the Window can be created with as few as 5 lines of code.&amp;nbsp; How and what your gadget window does is entirely up to you.&amp;nbsp; (I will apologize at this point in time for how bad my gadget will look.&amp;nbsp; I am not a graphical person at all and my colour coordination is really, really bad.)&lt;/P&gt;
&lt;P&gt;What I decided to do was I wanted something that would play some music as I worked on my computer.&amp;nbsp; VbCity Leader and Microsoft MVP Ged Mead showed us how to &lt;A href="http://blogs.vbcity.com/xtab/archive/2008/06/10/9091.aspx" target=_blank&gt;add sound to a WPF app&lt;/A&gt;, so I decided to incorporate that idea to my project.&lt;/P&gt;
&lt;P&gt;Now admittedly what we will end up at the end of this post is not very exciting or versatile, but it is a start and can be expanded on to suit your wishes.&amp;nbsp; I just want to show the basics on how to create the gadget window.&lt;/P&gt;
&lt;P&gt;The first thing we need to do is create a new WPF Application and the XAML for it is pretty basic.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Before you can start adding code to the code behind page there is one thing that you must do and that is you must add a Name property to the XAML of the Window.&amp;nbsp; Until you do that you don&amp;#8217;t have, on the code behind page, access to the Events of the window.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;I know that it looks like can get to the Window1 Events, but if you tried to set or change any settings for Window1 you would get errors. &lt;/P&gt;
&lt;P&gt;So in the XAML of your page you just need to add a Name property.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/03gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;I also changed the Title of the page as you can see the title in the Taskbar of your computer.&lt;/P&gt;
&lt;P&gt;Now that we have a name for the form we can tap into the events of the page itself and start adding code to the code behind.&amp;nbsp; This was when I ran into the first gotcha.&lt;/P&gt;
&lt;P&gt;The first gotcha I ran across was in the placement of the code I was using.&amp;nbsp; The first time I tried to add the code I used the Form_Loaded event, an event that I have used for setting properties of the form in the past, which has always worked like a charm.&amp;nbsp;&amp;nbsp; The code I used was:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/04gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;What happened, however, when I tried to run my project to see what happened was I got an InvalidOperationException .&amp;nbsp; The reason this exception was thrown is because you can not set the AllowsTransparency property of a form once the window has been shown.&lt;/P&gt;
&lt;P&gt;To get around this problem I put the code in the Initialize event of the form which let me set all the properties of the form that I wanted.&lt;/P&gt;
&lt;P&gt;As you can see by the code above, I have set the height and width of the form to 200, then I made changes to the three properties that really make this a gadget type window.&lt;/P&gt;
&lt;P&gt;The first property I set was to set the AllowsTransparency to True.&amp;nbsp; What this property does is indicates whether the client area of the window supports transparency.&lt;/P&gt;
&lt;P&gt;The second property set was the Background of the form.&amp;nbsp; This is set to the color Transparent.&lt;/P&gt;
&lt;P&gt;The third property set was the WindowStyle.&amp;nbsp; What the WindowsStyle property does is tell the application what sort of border to put on the window.&amp;nbsp; By setting the style to None, the ControlBox which you would normally see at the top right of a window are not show effectively removing the border of the form.&lt;/P&gt;
&lt;P&gt;If you were to run the project now you would not actually see anything because your form is transparent and there are no other controls on it just yet.&amp;nbsp; You could verify that it is running by taking a look at the Taskbar on your computer.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/05gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;(You certainly don't need to set the properties of the form, then add controls like I am doing, you could set up your form like you want it then make whatever changes you want to make.)&lt;/P&gt;
&lt;P&gt;On my form I decided that I am going to have an Ellipse and two Buttons.&amp;nbsp; One button is to start the music and one to exit the Application.&lt;/P&gt;
&lt;P&gt;Let's start with the Ellipse since this will be what our "form" will end up looking like.&lt;/P&gt;
&lt;P&gt;First off I added the Ellipse to the XAML of my form making sure that I gave it a name so that we could set its properties on the code behind page.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/06gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Next I made the changes to the properties of the Ellipse on the code behind page.&amp;nbsp; I set the Fill property (again I apologize for any lack of graphic artistry), the Opacity, Width, Height and because I didn't want to just have a flat Ellipse showing I added a BitmapEffect.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/07gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The Opacity and BitmapEffect properties are the interesting ones here.&amp;nbsp; By setting the Opacity I can regulate how see through my ellipse is and the BitmapEffect has added a beveled edge around the ellipse, just to add a little bit of depth to the graphic.&lt;/P&gt;
&lt;P&gt;Now when the project is run you can see the ellipse on the form.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/08gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Next buttons are added to the XAML of thewindow again making sure that Names are given to each one.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/09gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Then set the properties of the buttons on the code behind page.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/10gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/11gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The Height, Width and Content are set for both buttons as well as the VerticalAlignment property.&amp;nbsp; For the button that will exit the application the Forground property is set to Red to have it stand out.&lt;/P&gt;
&lt;P&gt;The last property that is assigned for the buttons is the Margin property which is used to position the buttons where I wanted them on the form over the ellipse.&amp;nbsp; Setting this property was a little hit and miss as I was setting it via code so I could not see on the form where the buttons were actually going to end up.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/12gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Now that I had the form looking like I wanted, all that was left was to be able to move and position the window anywhere I wanted to put it, have music play when I clicked the &amp;gt; button and to be able to quit the application.&lt;/P&gt;
&lt;P&gt;To make the window move to a different position on the screen all that is required is one small line of code in the MouseLeftButtonDown event of the window.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/13gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Now if the application is run and the left mouse button is held down you can move the ellipse anywhere on your screen.&lt;/P&gt;
&lt;P&gt;To close the application, just put the following code in the Click event of the close button.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/14gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The last thing to be done is to make music.&amp;nbsp; (Thanks once again to &lt;A href="http://blogs.vbcity.com/xtab/archive/2008/06/10/9091.aspx" target=_blank&gt;Ged&lt;/A&gt; for pointing out the pitfalls of playing music.)&lt;/P&gt;
&lt;P&gt;(Admittedly there could be a whole lot more functionality to the application here to let, for example, the user either enter or select a path and have the application play each audio file in the directory one after the other, but that is more than I wanted to show here.&amp;nbsp; Maybe I will get to that in a future post.)&lt;/P&gt;
&lt;P&gt;We start with adding the Imports Statement&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : "http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx"--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="OVERFLOW: auto; HEIGHT: 30pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;Imports&lt;/FONT&gt; System.Media&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;Add a Variable to hold our instance of a media player&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : "http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx"--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="OVERFLOW: auto; HEIGHT: 30pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt; MyPlayer &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; MediaPlayer&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;Lastly the code to play the music&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/15gadget.jpg"&gt;&lt;/P&gt;
&lt;P&gt;So the complete XAML for the gadget is:&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : "http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx"--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 125pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Window&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Win1"&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;Class&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Window1"&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#ff0000&gt; xmlns&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#ff0000&gt; xmlns&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;:&lt;/FONT&gt;&lt;FONT color=#ff0000&gt;x&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#ff0000&gt; Title&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Neil's Gadget"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Ellipse&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Ellipse1" /&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Button&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Button1"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Button&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Button&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Button&lt;/FONT&gt;&lt;FONT color=#ff0000&gt; Name&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;="Button2"&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Button&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Button&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT color=#a31515&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Grid&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/DIV&gt;&amp;lt;/&lt;/FONT&gt;&lt;FONT color=#a31515&gt;Window&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&amp;gt;&lt;/FONT&gt;&lt;SPAN style="FONT-FAMILY: Times New Roman"&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;and the complete code:&lt;/P&gt;
&lt;P&gt;&lt;!-- --Start of code block
--&gt;&lt;!-- CodeBlock by R.Verpalen 2005 : "http://blogs.vbcity.com/hotdog/archive/2005/12/30/5759.aspx"--&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV style="HEIGHT: 300pt; BACKGROUND-COLOR: #dcdcdc"&gt;&lt;FONT color=#0000ff&gt;Imports&lt;/FONT&gt; System.Media&lt;FONT color=#0000ff&gt;&lt;BR&gt;Class&lt;/FONT&gt; Window1&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Dim&lt;/FONT&gt; MyPlayer &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; MediaPlayer&lt;FONT color=#0000ff&gt;&lt;BR&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt; Win1_Initialized(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; sender &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Object&lt;/FONT&gt;, &lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; e &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; System.EventArgs) &lt;FONT color=#0000ff&gt;Handles&lt;/FONT&gt; Win1.Initialized&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;With&lt;/FONT&gt; Win1 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Height = 200&lt;BR&gt;.Width = 200&lt;BR&gt;.Background = Brushes.Transparent&lt;BR&gt;.AllowsTransparency = &lt;FONT color=#0000ff&gt;True&lt;/FONT&gt;&lt;BR&gt;.WindowStyle = Windows.WindowStyle.None&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;With&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;With&lt;/FONT&gt; Ellipse1 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Fill = Brushes.Tomato&lt;BR&gt;.Opacity = 0.5&lt;BR&gt;.Width = 150&lt;BR&gt;.Height = 110&lt;BR&gt;.BitmapEffect = &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; System.Windows.Media.Effects.BevelBitmapEffect&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;With&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;With&lt;/FONT&gt; Button1 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Height = 20&lt;BR&gt;.Width = 20&lt;BR&gt;.Content = &lt;FONT color=#a31515&gt;"X"&lt;/FONT&gt;&lt;BR&gt;.Foreground = Brushes.Red&lt;BR&gt;.VerticalAlignment = Windows.VerticalAlignment.Center&lt;BR&gt;.Margin = &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Thickness(40, 70, 20, 20)&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;With&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;With&lt;/FONT&gt; Button2 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;.Height = 20&lt;BR&gt;.Width = 20&lt;BR&gt;.Content = &lt;FONT color=#a31515&gt;"&amp;gt;"&lt;/FONT&gt;&lt;BR&gt;.VerticalContentAlignment = Windows.VerticalAlignment.Center&lt;BR&gt;.Margin = &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Thickness(0, 70, 20, 20)&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;With&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt; Win1_MouseLeftButtonDown(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; sender &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Object&lt;/FONT&gt;, &lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; e &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; System.Windows.Input.MouseButtonEventArgs) &lt;FONT color=#0000ff&gt;Handles&lt;/FONT&gt; Win1.MouseLeftButtonDown&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Me&lt;/FONT&gt;.DragMove()&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt; Button1_Click(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; sender &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Object&lt;/FONT&gt;, &lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; e &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; System.Windows.RoutedEventArgs) &lt;FONT color=#0000ff&gt;Handles&lt;/FONT&gt; Button1.Click&lt;FONT color=#0000ff&gt; 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;Me&lt;/FONT&gt;.Close()&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;&lt;BR&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt; Button2_Click(&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; sender &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Object&lt;/FONT&gt;, &lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt; e &lt;FONT color=#0000ff&gt;As&lt;/FONT&gt; System.Windows.RoutedEventArgs) &lt;FONT color=#0000ff&gt;Handles&lt;/FONT&gt; Button2.Click 
&lt;DIV style="MARGIN-LEFT: 20pt"&gt;MyPlayer = &lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; MediaPlayer&lt;BR&gt;MyPlayer.Open(&lt;FONT color=#0000ff&gt;New&lt;/FONT&gt; Uri(&lt;FONT color=#a31515&gt;"symphony5_beethoven_radio3.mp3"&lt;/FONT&gt;, UriKind.Relative)) &lt;BR&gt;MyPlayer.Play()&lt;FONT color=#0000ff&gt;&lt;/DIV&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Sub&lt;/DIV&gt;End&lt;/FONT&gt; &lt;FONT color=#0000ff&gt;Class&lt;/FONT&gt;&lt;/DIV&gt;&lt;!-- 
End of code block----&gt;
&lt;P&gt;How simple can it get?&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9108.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Multi-Line commenting</title><link>http://blogs.vbcity.com/canoz/archive/2008/06/07/9088.aspx</link><pubDate>Sat, 07 Jun 2008 02:00:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/06/07/9088.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9088.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/06/07/9088.aspx#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9088.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9088.aspx</trackback:ping><description>&lt;P&gt;There are times when I have to wonder if I am the only person who does not know some things.&lt;/P&gt;
&lt;P&gt;I ran into this self doubt again the other day when I was watching one of Ron Cundiff's &lt;A href="http://msdnwebcastportal.com/DesktopDefault.aspx?tabindex=4&amp;amp;tabid=23" target=_blank&gt;VB.NET Soup To Nuts&lt;/A&gt; WebCasts. &lt;/P&gt;
&lt;P&gt;During the WebCast one of the participants asked if there was a way to comment multiple lines of code.&amp;nbsp; When I heard this my ears perked up and I got very interested.&lt;/P&gt;
&lt;P&gt;In the, almost, ten years that I have been writing code, I always have commented out any lines of code I didn't want to run one line at a time.&amp;nbsp; What a time consuming effort that can be depending on the number of lines you are working with.&amp;nbsp; I also ended up with unformatted (not indented) code,&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/07comment.jpg"&gt;&lt;/P&gt;
&lt;P&gt;and usually put the comment apostrophe in the wrong place when an indented line of code moved once the one above had been commented out.&lt;/P&gt;
&lt;P&gt;Well this is all changed now.&amp;nbsp; Low and behold there are buttons in the Visual Studio IDE that let you comment out, or uncomment, any lines of code that you have selected.&amp;nbsp; All this time I had a simple way literally staring me in the face.&lt;/P&gt;
&lt;P&gt;Right in the main Toolbar there is the Comment Button&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01comment.jpg"&gt;&lt;/P&gt;
&lt;P&gt;and the Uncomment Button.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02comment.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Now all I need to do to comment, or uncomment, multiple lines is highlight the code I want and click a button.&lt;/P&gt;
&lt;P&gt;One other great thing about this feature is that the code stays formatted (indented) even after commenting which, I believe, makes it much easier to read.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/04comment.jpg"&gt;&lt;/P&gt;
&lt;P&gt;*sigh*&amp;nbsp; Now I only have to wonder what other time saving &amp;#8220;wonders&amp;#8221; I will have to wait ten years to discover. &lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9088.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>ClickOnce Deployment – Deploying files with your application</title><link>http://blogs.vbcity.com/canoz/archive/2008/06/07/9087.aspx</link><pubDate>Sat, 07 Jun 2008 01:30:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/06/07/9087.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9087.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/06/07/9087.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9087.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9087.aspx</trackback:ping><description>&lt;P&gt;In a &lt;A href="http://blogs.vbcity.com/canoz/archive/2008/05/03/9056.aspx" target=_blank&gt;previous post&lt;/A&gt;, I showed you how you can deploy your application using ClickOnce.&amp;nbsp; Looking at how to deploy extra files, like my first look at ClickOnce, was prompted by a &lt;A href="http://www.vbcity.com/forums/topic.asp?tid=155077" target=_blank&gt;post on vbCity&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Now I will admit that I wasn&amp;#8217;t as sharp answering the original question as I could have been so be gentle with your opinion of me if you read through the thread.&amp;nbsp; (In fact it took me two days to work out that when the person asking mentioned the "Publish" tab that they meant ClickOnce.&amp;nbsp; I guess this is what I get for trying to answer questions a 3:30am.)&lt;/P&gt;
&lt;P&gt;Once I was in synch with the problem a little research provided me with an answer.&lt;/P&gt;
&lt;P&gt;You would have thought that once you added the files to your project in Visual Studio that they would be automatically included in the deployment package but this is not the case.&amp;nbsp; I added the file to my project,&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/003ClickOnceAddFiles.jpg"&gt;&lt;/P&gt;
&lt;P&gt;but if you were to then take a look at the files that are included in the deployment package by going to the Publish tab of your projects properties page and click the "Application Files" button you get a nasty little shock.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/007ClickOnceAddFiles.jpg"&gt;&lt;/P&gt;
&lt;P&gt;No additional file even though we have added it to the project.&lt;/P&gt;
&lt;P&gt;The reason for this is that we have not told Visual Studio what we want to do with the file.&amp;nbsp; What is needed is to make one change to the properties of the file.&amp;nbsp; The property we want to change is the Build property.&lt;/P&gt;
&lt;P&gt;By default, depending on the extension of the file,&amp;nbsp;when you add a file to a Visual Studio project the Build property is set to "None".&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/004ClickOnceAddFiles.jpg"&gt;&lt;/P&gt;
&lt;P&gt;(If you were using a deployment method like creating a Windows Installer file (.msi) then this would not be a problem because of the was you create the Installer file.&amp;nbsp; With ClickOnce deployment unless you change the Build property it assumes that you don&amp;#8217;t want to include the file in the deployment package.)&lt;/P&gt;
&lt;P&gt;In the properties window of the file select &amp;#8220;Content&amp;#8221; from the choices for the files Build property.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/005ClickOnceAddFiles.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Now ClickOnce will recognize that the file is to be deployed with your application and if you go back to the My Properties page of your app, click on the "Publish" tab and click on the "Application Files" button you will see that the file in the list of files to be included.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/008ClickOnceAddFiles.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Publish your application, then you can do a test install and you will see by looking at the files that are installed on your computer now include the additional files.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/009ClickOnceAddFiles.jpg"&gt;&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9087.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>ClickOnce increments</title><link>http://blogs.vbcity.com/canoz/archive/2008/05/23/9072.aspx</link><pubDate>Fri, 23 May 2008 22:51:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/05/23/9072.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9072.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/05/23/9072.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9072.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9072.aspx</trackback:ping><description>&lt;P&gt;&lt;SPAN class=siteName&gt;&lt;FONT color=#000000&gt;Rockford Lhotka &lt;A href="http://www.lhotka.net/weblog/ClickOnceAndIncrementalUpdates.aspx"&gt;posted up&lt;/A&gt; some details about how ClickOnce handles what is downloaded when it performs an incremental update.&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=siteName&gt;The more I look at ClickOnce the more I am coming to appreciate it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=siteName&gt;I know this goes against the ClickOnce idea, but if the end user could only determine where the Application is installed.&amp;nbsp; I suppose if I want to be that fussy I would just distribute and install via a Windows Installer file. &lt;/SPAN&gt;&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9072.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>ClickOnce deployment videos</title><link>http://blogs.vbcity.com/canoz/archive/2008/05/09/9066.aspx</link><pubDate>Fri, 09 May 2008 20:59:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/05/09/9066.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9066.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/05/09/9066.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9066.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9066.aspx</trackback:ping><description>&lt;P&gt;I have finished making videos showing how to deploy and update Applications using ClickOnce.&amp;nbsp; All the videos have been zipped so that you can download them and watch at your leisure.&lt;/P&gt;
&lt;P&gt;I orignally thought it was going to be in two parts, but decided in the long run to make it three parts to keep the length ove the video and size of the files down.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.neilknobbe.com/videos/ClickOnce.zip"&gt;Part 1&lt;/A&gt; goes through the settings.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.neilknobbe.com/videos/ClickOnce1.zip"&gt;Part 2&lt;/A&gt; shows the publishing process as well as downloading and installing.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.neilknobbe.com/videos/ClickOnce2.zip"&gt;Part 3&lt;/A&gt; shows how ClickOnce handles updates to the Application.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9066.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>V. Neil Knobbe</dc:creator><title>Deploying applications with ClickOnce</title><link>http://blogs.vbcity.com/canoz/archive/2008/05/03/9056.aspx</link><pubDate>Sat, 03 May 2008 19:49:00 GMT</pubDate><guid>http://blogs.vbcity.com/canoz/archive/2008/05/03/9056.aspx</guid><wfw:comment>http://blogs.vbcity.com/canoz/comments/9056.aspx</wfw:comment><comments>http://blogs.vbcity.com/canoz/archive/2008/05/03/9056.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.vbcity.com/canoz/comments/commentRss/9056.aspx</wfw:commentRss><trackback:ping>http://blogs.vbcity.com/canoz/services/trackbacks/9056.aspx</trackback:ping><description>&lt;P&gt;&lt;STRONG&gt;ClickOnce Deployment&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;A recent post on &lt;A href="http://www.vbcity.com/"&gt;vbCity &lt;/A&gt;regarding deploying an application with ClickOnce got me wondering about doing deployment with ClickOnce.&lt;/P&gt;
&lt;P&gt;I have always done deployment of applications by creating and using a Setup and Deployment package which created a .msi installer file, so it was interesting to see some of the differences between the two distribution methods.&lt;/P&gt;
&lt;P&gt;First off I created a simple application to test the ClickOnce distribution and installation method with.&amp;nbsp; What I created was nothing special, just a windows form with at button that, when it&amp;nbsp;is&amp;nbsp;clicked, a message box is shown.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/01ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/02ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;As you can see the application is nothing special.&amp;nbsp; One other thing that I did was add a version number to the text of the form.&amp;nbsp; I did this to show how ClickOnce deployment installs newer versions as they are available.&amp;nbsp; I will get to this a little later.&lt;/P&gt;
&lt;P&gt;Once your application is ready to go you want to open up the &lt;STRONG&gt;My Project&lt;/STRONG&gt; page from the solution explorer.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/03ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;On the My Project&amp;nbsp; page click the Publish tab.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/04ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;From this page, you define where your application is going to be available from and how it is going to be installed on the client machine. &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/05ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Taking a look at the publish page from the top down the first thing you will want to enter will be the location (URL) that you are going to publish to.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/06ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;As you can see from the image above, you have three options for the location that you are going to publish to.&amp;nbsp; You can publish to a web site (&lt;A href="http://www.somesite.com/"&gt;http://www.somesite.com&lt;/A&gt;) but to do this you must have FrontPage extensions enabled on the web site.&amp;nbsp; You can publish to a ftp server (&lt;A href="ftp://www.somesite.com/"&gt;ftp://www.somesite.com&lt;/A&gt;) as long as you have ftp permissions for the site, or you can publish to a local file (C:\myApplication). (For distribution this last option is not really that realistic unless you are on an internal network where you can share out the directory to others on the network.)&lt;/P&gt;
&lt;P&gt;The next option you have is to determine if you application is available offline or not. &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/07ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;If you don&amp;#8217;t want the users to be able to access your application offline then select the online option.&amp;nbsp; This will cause your application to run, but not show in the start menu of the user&amp;#8217;s computer.&amp;nbsp; They would need to download the application each time they wanted to use your application.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;If you make the application available offline then a shortcut is included in the start menu of the computer making the application accessible all the time.&lt;/P&gt;
&lt;P&gt;To the right of the Install settings there is a group of four buttons.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/08ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;These buttons define what files are to be included with your application, any prerequisites that the end user must have installed on their computer to run your application, how and when to get updates as well as options such as adding the publishers name, product name etc.&lt;/P&gt;
&lt;P&gt;Under the install mode and the buttons there is the version boxes plus the option to automatically increment the revision with each publish.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/09ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Keeping the increment box checked is, I believe, quite important.&amp;nbsp; If you don&amp;#8217;t remember to increment the version number when you republish the application then the next time the application checks for updates it looks at the version number and if that number has not changed, even though your application may have, it assumes that there is nothing newer and opens the currently installed version.&lt;/P&gt;
&lt;P&gt;The last two items on the window are the Publish Wizard and Publish Now buttons.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/10ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;The Publish Wizard button will open a series of dialogues and walk you through the settings that you want your installer to use.&lt;/P&gt;
&lt;P&gt;The Publish Now button will use the information that you have entered on the page and create the installer files then, if you are deploying the files to either a web site or ftp site, prompt you for log on details.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/13ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Simply insert your username and password then click the OK button and the files required will be uploaded to the URL you specified.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/14ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;You can see in the image above that ClickOnce has created two files and one directory on the web server.&amp;nbsp; Within the Application Files directory you would find one directory containing each version that has been published and uploaded.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/17ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;I just happen to have two versions in the application files directory and the one that will get distributed will always be the latest version.&amp;nbsp;(I mentioned earlier that I had put a version number&amp;nbsp;on the text of the&amp;nbsp;form and the version number you should see is 2&amp;nbsp;not 1 like the image&amp;nbsp;of the form above.)&amp;nbsp;It would not matter how many older versions I have on my server.&lt;/P&gt;
&lt;P&gt;Now you may distribute the address of your application to your clients.&amp;nbsp; The file that you want to point to is the Application Manifest file, not the setup file.&amp;nbsp; From the image above I would point people to the URL &lt;A href="http://www.neilknobbe.com/clickonce/ClickOnce.application" target=_blank&gt;http://www.neilknobbe.com/clickonce/ClickOnce.application&lt;/A&gt;.&amp;nbsp; (The link is live and you can navigate to it, download and install the application that I mentioned at the start of this post.&amp;nbsp; It is not very exciting, but it shows how ClickOnce works.)&lt;/P&gt;
&lt;P&gt;The prerequisites for installation, which you would have set earlier, are checked.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/25ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;If all is ok, the user will be prompted to install the application.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://www.neilknobbe.com/blogimages/24ClickOnce.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Once installed your ClickOnce deployed application is ready to use.&lt;/P&gt;&lt;img src ="http://blogs.vbcity.com/canoz/aggbug/9056.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>