<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><!--Generated by RSSMaster 1.0 (http://www.softtool.info/rssmaster)--><rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>VB Feeds</title>
    <link>http://vbfeeds.com/</link>
    <description>VB Feeds - All Visual Basic Feeds in One Place!</description>
    <generator>RSSMaster 1.0 (http://www.softtool.info/rssmaster)</generator>
    <language>en-US</language>
    <copyright>Copyright 2005 vbfeeds.com</copyright>
    <managingEditor>Serge Baranovsky &lt;sergeb@vbcity.com&gt;</managingEditor>
    <pubDate>Wed, 22 May 2013 12:00:00 -07:00</pubDate>
    <lastBuildDate>Wed, 22 May 2013 06:12:04 -07:00</lastBuildDate>
    <image>
      <url>http://vbfeeds.com/images/vbfeeds100x30.gif</url>
      <title>VB Feeds</title>
      <link>http://vbfeeds.com/</link>
      <width>100</width>
      <height>30</height>
      <description>VB Feeds - All Visual Basic Feeds in One Place!</description>
    </image>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/vbfeeds" /><feedburner:info uri="vbfeeds" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fvbfeeds" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fvbfeeds" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2Fvbfeeds" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/vbfeeds" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fvbfeeds" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fvbfeeds" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fvbfeeds" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://my.feedlounge.com/external/subscribe?url=http%3A%2F%2Ffeeds.feedburner.com%2Fvbfeeds" src="http://static.feedlounge.com/buttons/subscribe_0.gif">Subscribe with FeedLounge</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2Fvbfeeds" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:browserFriendly>This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site, subject to copyright and fair use.</feedburner:browserFriendly><item>
      <title>How To Use XPath and an XML Data Island in a WPF Application</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: XTab (Ged Mead)&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;p&gt;When you need to use XML data as a data source in a WPF application, most times you’ll probably pull the XML document down from the web, a server, a separate file, or other external source.&amp;#160; Occasionally though, you might have a situation where you can usefully embed the XML data right inside the project.&amp;#160; Obviously, you lose one of the (if not the most) important aspects of data handling -&amp;#160; the ability to chop and change the data at runtime.&amp;#160; But for the sake of example, if you have unchanging data that you want to embed, here’s how you can use an XML data island.&lt;/p&gt;  &lt;p&gt;The key to doing this is to use an XData element with an XmlDataProvider in the XAML markup.&amp;#160; I’ve talked about the XmlDataProvider in several earlier blogs, including &lt;a href="http://vbcity.com/blogs/xtab/archive/2009/08/22/how-to-use-the-wpf-listview.aspx" target="_blank"&gt;this one that uses it with a ListView&lt;/a&gt; and &lt;a href="http://vbcity.com/blogs/xtab/archive/2009/11/14/wpf-hierarchicaldatatemplates-and-master-detail-data-display.aspx" target="_blank"&gt;this one that looks at the tricky task of using HierarchicalDataTemplates&lt;/a&gt;.&amp;#160;&amp;#160; But I don’t think I’ve covered XData previously.&amp;#160; Simply put, XData is a XAML type that tells the XAML processor at runtime to ignore anything inside the opening and closing XData tags.&amp;#160; You can think of similar functionality that’s available elsewhere, such as CData, that does the same thing.&amp;#160; So if the following markup is included in a XAML file:&lt;/p&gt;  &lt;div style="font-family:courier new;background:white;color:black;font-size:10pt;"&gt;   &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Window.Resources&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;XmlDataProvider&lt;/span&gt;&lt;span style="color:red;"&gt; x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Key&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;SalesTotal&amp;quot;&lt;/span&gt;&lt;span style="color:red;"&gt; XPath&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Sales&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:#a31515;"&gt;XData&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Sales&lt;/span&gt;&lt;span style="color:red;"&gt; xmlns&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SalesPerson&lt;/span&gt;&lt;span style="color:red;"&gt; Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Larry Jacobs&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Area&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;East&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Area&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;AnnualTotal&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;135356&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;AnnualTotal&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SalesPerson&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SalesPerson&lt;/span&gt;&lt;span style="color:red;"&gt; Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Donna Procter&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Area&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;NorthEast&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Area&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;AnnualTotal&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;159932&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;AnnualTotal&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SalesPerson&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SalesPerson&lt;/span&gt;&lt;span style="color:red;"&gt; Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Terence Earnshaw&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Area&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;West&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Area&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;AnnualTotal&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;163755&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;AnnualTotal&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SalesPerson&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SalesPerson&lt;/span&gt;&lt;span style="color:red;"&gt; Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Ray Davison&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Area&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;NorthEast&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Area&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;AnnualTotal&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;123628&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;AnnualTotal&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SalesPerson&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Sales&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:#a31515;"&gt;XData&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;XmlDataProvider&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Window.Resources&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;none of that XML data inside the XData tags will be looked at by the XAML processor.&lt;/p&gt;  &lt;p&gt;So, you now have an embedded data source.&amp;#160; The next step is to do something with it.&amp;#160; What we’ll do is display the SalesPersons’ names in a ListBox.&amp;#160; Of course, in a real world application, you’d expand on this, probably use a DataTemplate and display more details in a better UI.&lt;/p&gt;  &lt;p&gt;&amp;#160; Here’s the markup that creates the ListBox and sets the key properties:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div style="font-family:courier new;background:white;color:black;font-size:10pt;"&gt;   &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ListBox&lt;/span&gt;&lt;span style="color:red;"&gt; x&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:red;"&gt;Name&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;lstNames&amp;quot;&lt;/span&gt;&lt;span style="color:red;"&gt; Margin&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;8&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;Padding&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;4,4,8,4&amp;quot;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Center&amp;quot;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:red;"&gt;ItemsSource&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:red;"&gt; Source&lt;/span&gt;&lt;span style="color:blue;"&gt;={&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:red;"&gt; SalesTotal&lt;/span&gt;&lt;span style="color:blue;"&gt;},&lt;/span&gt;&lt;span style="color:red;"&gt; XPath&lt;/span&gt;&lt;span style="color:blue;"&gt;=SalesPerson}&amp;quot;&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:red;"&gt;DisplayMemberPath&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;@Name&amp;quot;&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:#a31515;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ListBox&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;In terms of data binding, the third and fourth lines are the important ones.&amp;#160; The Binding Source points to that XML data island I created first and named SalesTotal.&amp;#160; Then, I use XPath to identify that I want only the data within the SalesPerson tag to be included.&amp;#160; As it happens, that is all the data available, but it is possible to drill down further or to use more complex XML structures and pluck out parts of the data.&amp;#160; &lt;/p&gt;  &lt;p&gt;DisplayMemberPath is a property of the ListBox whose task is to identify the path to the specific item to be displayed.&amp;#160; Actually, that’s not strictly accurate.&amp;#160; It’s a property of the ItemControl type, but as ListBox inherits from ItemControl, the effect is the same.&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;The only remaining feature that I should highlight is the use of the @ symbol in front of the Name field.&amp;#160; Any ideas why I used that?&amp;#160; Well spotted if you did – Name is an attribute of SalesPerson, not a child element.&amp;#160; So the @ symbol tells the application to go and look for an attribute named Name and not an element.&lt;/p&gt;  &lt;p&gt;With that markup in place, you’re good to go.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://vbcity.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xtab.metablogapi/2605.xmldataisland_5F00_203345B9.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="xmldataisland" border="0" alt="xmldataisland" src="http://vbcity.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/xtab.metablogapi/7776.xmldataisland_5F00_thumb_5F00_5E4C606A.png" width="401" height="401" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I mentioned that you can drill down into the XML.&amp;#160; For example, you could use something like this if you wanted to display the Areas:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div style="font-family:courier new;background:white;color:black;font-size:10pt;"&gt;   &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:red;"&gt;ItemsSource&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:red;"&gt; Source&lt;/span&gt;&lt;span style="color:blue;"&gt;={&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:red;"&gt; SalesTotal&lt;/span&gt;&lt;span style="color:blue;"&gt;},&lt;/span&gt;&lt;span style="color:red;"&gt; XPath&lt;/span&gt;&lt;span style="color:blue;"&gt;=SalesPerson}&amp;quot;&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:red;"&gt;DisplayMemberPath&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Area&amp;quot;&lt;/span&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So, there’s a simple explanation of how you can use an XML Data Island in a WPF application. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://vbcity.com/aggbug.aspx?PostID=698960" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/_WouzU-8F4Q" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/_WouzU-8F4Q/post.aspx</link>
      <author>XTab (Ged Mead) - Ged Mead</author>
      <pubDate>Wed, 22 Dec 2010 12:05:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7671</feedburner:origLink></item>
    <item>
      <title>Hashing in .NET using System.Security.Cryptography</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: VB &amp; .NET Blogs @ vbCity.com&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;link type="text/css" rel="stylesheet" href="/dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css"&gt;&lt;/link&gt;
&lt;script language="javascript" src="/dp.SyntaxHighlighter/Scripts/shCore.js"&gt;&lt;/script&gt;
&lt;script language="javascript" src="/dp.SyntaxHighlighter/Scripts/shBrushVb.js"&gt;&lt;/script&gt;
&lt;p&gt;Hashing using the built-in Crypto-Service Providers that .NET comes with is so straight-forward that it&amp;#39;s almost not even blog-worthy. &amp;nbsp;However, a friend asked me to write this so might as well share it.&lt;/p&gt;
&lt;p&gt;Preview:&lt;/p&gt;
&lt;p&gt;&lt;img height="611" width="600" src="http://zhost.tk/u/0q/1.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The following other hashing Crypto-Service Providers come with the System.Security.Cryptography namespace:&lt;/p&gt;
&lt;p&gt;&lt;img height="196" width="600" src="http://zhost.tk/u/4q/2.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t want to just hash text, you can also drag &amp;amp; drop a file from the Desktop or Windows Explorer onto this second textbox and hash that file&amp;#39;s contents:&lt;/p&gt;
&lt;p&gt;&lt;img height="76" width="600" src="http://zhost.tk/u/j7/3.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The full code is at the end of this post.&amp;nbsp; To crecreate this program on your own machine do the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open your Visual Studio IDE and create a new Windows Forms Application.&amp;nbsp; Name it whatever you want (I used &amp;quot;hasher&amp;quot;).&lt;/li&gt;
&lt;li&gt;In the Solution Explorer sidebar, you should have a form called Form1.vb.&amp;nbsp; Right-click that and select View Code.&lt;/li&gt;
&lt;li&gt;Select all existing text with CTRL+A and hit Delete or Backspace to clear it.&lt;/li&gt;
&lt;li&gt;Copy the full code below and paste it in.&lt;/li&gt;
&lt;li&gt;The program is ready.&amp;nbsp; You can hit F5 or click the green arrow icon to run it.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Section 1. &amp;nbsp;Housekeeping.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Most of this code is actually not relevant to hashing and can be ignored.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The entire class declarations area and the Form&amp;#39;s&amp;nbsp;&lt;i&gt;Load()&lt;/i&gt; event sub is doing nothing but instancing, adding, positioning, and setting up the controls on the form.&lt;/li&gt;
&lt;li&gt;There are two subss for the the&amp;nbsp;&lt;strong&gt;txtSourceFile&lt;/strong&gt; textbox; one for the &lt;i&gt;DragEnter()&lt;/i&gt; event, and the other for the &lt;i&gt;DragDrop()&lt;/i&gt; event. &amp;nbsp;Those can be ignored as well, as this blog post is not really about dragging and dropping.&lt;/li&gt;
&lt;li&gt;The two button &lt;i&gt;Click()&lt;/i&gt; event subs (one for&amp;nbsp;&lt;strong&gt;btnHashText&lt;/strong&gt;&amp;nbsp;and the other for &lt;strong&gt;btnHashFile&lt;/strong&gt;) just do silly things like clear previous results, check for the existence of the file (if applicable), and call the hash function.&lt;/li&gt;
&lt;li&gt;The &lt;i&gt;ShowResult()&lt;/i&gt; sub just takes the returned hashed bytes and adds it to the results area in the appropriate formats.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Section 2. &amp;nbsp;Meat.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The only two sections of code that really are of any significance to this blog is the&amp;nbsp;&lt;i&gt;GetHashBytesFromFile()&lt;/i&gt; function and the&amp;nbsp;&lt;i&gt;GetHashBytesFromString()&lt;/i&gt; sub. &amp;nbsp;They are mostly the same too.&lt;/p&gt;
&lt;p&gt;For the first one, we pass in a string,&amp;nbsp;&lt;strong&gt;pSourceFilePath&lt;/strong&gt;, which is the filename of the file we want to read and hash. &amp;nbsp;We use a stream to do this:&lt;/p&gt;
&lt;p&gt;&lt;pre name="3de45e588b5e409b989b3aa70a9bcd11" class="VB.NET"&gt;
Dim vDigestBytes As Byte() = Nothing
Using vStream As New System.IO.FileStream(pSourceFilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read, IO.FileShare.Delete)
    Using vHashProvider As New System.Security.Cryptography.MD5CryptoServiceProvider
        vDigestBytes = vHashProvider.ComputeHash(vStream)
    End Using
End Using
Return vDigestBytes
&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To use a different hash algorithm, just switch&amp;nbsp;&lt;i&gt;MD5CryptoServiceProvider&lt;/i&gt; with&amp;nbsp;&lt;i&gt;SHA1CryptoServiceProvider&lt;/i&gt; or any of the other Crypto-Service Providers that come with&amp;nbsp;the System.Security.Cryptography namespace.&lt;/p&gt;
&lt;p&gt;For the second one, we are just hashing a string,&amp;nbsp;&lt;strong&gt;pSourceText&lt;/strong&gt;, so there&amp;#39;s no need to use a stream.&lt;/p&gt;
&lt;p&gt;&lt;pre name="47736d3a2345425aa54bf02e02ca9942" class="VB.NET"&gt;
Dim vDigestBytes As Byte() = Nothing
Using vHashProvider As New System.Security.Cryptography.MD5CryptoServiceProvider
    vDigestBytes = vHashProvider.ComputeHash(System.Text.Encoding.UTF8.GetBytes(pSourceText))
End Using
Return vDigestBytes
&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The only assumption here is what encoding method to use to turn the given string into an array of bytes. &amp;nbsp;If you were to use Unicode or UTF-16, the string would be different (even though it looks the same) as each character would be made up of two bytes, and that would in turn make the hash digest different.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Section 3. &amp;nbsp;Full Code.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre name="01711b5ec0f84b1d952570566844cc04" class="VB.NET"&gt;
Option Strict On

Public Class Form1

    &amp;#39;Declare controls.
    Private gPadding As Integer = 12
    Private gLabelFont As New System.Drawing.Font(System.Drawing.FontFamily.GenericSansSerif, 12.0F, FontStyle.Bold, GraphicsUnit.Point)
    Private lblHashAlgo As New System.Windows.Forms.Label
    Private drpHashAlgo As New System.Windows.Forms.ComboBox
    Private lblSourceText As New System.Windows.Forms.Label
    Private txtSourceText As New System.Windows.Forms.TextBox
    Private WithEvents btnHashText As New System.Windows.Forms.Button
    Private lblSourceFile As New System.Windows.Forms.Label
    Private WithEvents txtSourceFile As New System.Windows.Forms.TextBox
    Private WithEvents btnHashFile As New System.Windows.Forms.Button
    Private lblHashResults As New System.Windows.Forms.Label
    Private lvwHashResult As New System.Windows.Forms.ListView
    Private txtHashResult As New System.Windows.Forms.TextBox

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        &amp;#39;Setup controls.
        With Me
            .Size = New System.Drawing.Size(600, 600)
            .Text = &amp;quot;Hasher&amp;quot;
            .FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle
            .MaximizeBox = False
            .Controls.Add(lblHashAlgo)
            .Controls.Add(drpHashAlgo)
            .Controls.Add(lblSourceText)
            .Controls.Add(txtSourceText)
            .Controls.Add(btnHashText)
            .Controls.Add(lblSourceFile)
            .Controls.Add(txtSourceFile)
            .Controls.Add(btnHashFile)
            .Controls.Add(lblHashResults)
            .Controls.Add(lvwHashResult)
            .Controls.Add(txtHashResult)
        End With
        With lblHashAlgo
            .Location = New System.Drawing.Point(gPadding, gPadding)
            .Size = New System.Drawing.Size(Me.ClientRectangle.Width - (gPadding * 2), 23)
            .BackColor = Color.SlateGray
            .ForeColor = Color.Orange
            .Font = gLabelFont
            .Text = &amp;quot;Choose Hash Algorithm:&amp;quot;
        End With
        With drpHashAlgo
            .Location = New System.Drawing.Point(gPadding, lblHashAlgo.Top + lblHashAlgo.Height + gPadding)
            .Width = Me.ClientRectangle.Width - (gPadding * 2)
            .DropDownStyle = ComboBoxStyle.DropDownList
            .Items.Add(&amp;quot;MD5&amp;quot;)
            .Items.Add(&amp;quot;RIPEMD-160&amp;quot;)
            .Items.Add(&amp;quot;SHA-1&amp;quot;)
            .Items.Add(&amp;quot;SHA-256&amp;quot;)
            .Items.Add(&amp;quot;SHA-384&amp;quot;)
            .Items.Add(&amp;quot;SHA-512&amp;quot;)
            .SelectedIndex = 0
        End With
        With lblSourceText
            .Location = New System.Drawing.Point(gPadding, drpHashAlgo.Top + drpHashAlgo.Height + gPadding)
            .Size = New System.Drawing.Size(Me.ClientRectangle.Width - (gPadding * 2), 23)
            .BackColor = Color.SlateGray
            .ForeColor = Color.Orange
            .Font = gLabelFont
            .Text = &amp;quot;Enter Text String to Hash:&amp;quot;
        End With
        With btnHashText
            .Width = 100
            .Location = New System.Drawing.Point(Me.ClientRectangle.Width - (btnHashText.Width + gPadding), lblSourceText.Top + lblSourceText.Height + gPadding)
            .Text = &amp;quot;&amp;lt;-- Hash Text&amp;quot;
        End With
        With txtSourceText
            .Location = New System.Drawing.Point(gPadding, lblSourceText.Top + lblSourceText.Height + gPadding)
            .Multiline = True
            .ScrollBars = ScrollBars.Both
            .Width = Me.ClientRectangle.Width - (gPadding + btnHashText.Width + (gPadding * 2))
            .Height = 100
            .Text = &amp;quot;The quick brown fox jumps over the lazy dog&amp;quot;
        End With
        With lblSourceFile
            .Location = New System.Drawing.Point(gPadding, txtSourceText.Top + txtSourceText.Height + gPadding)
            .Size = New System.Drawing.Size(Me.ClientRectangle.Width - (gPadding * 2), 23)
            .BackColor = Color.SlateGray
            .ForeColor = Color.Orange
            .Font = gLabelFont
            .Text = &amp;quot;Or Drag File to Hash from Windows onto Textbox:&amp;quot;
        End With
        With btnHashFile
            .Width = 100
            .Location = New System.Drawing.Point(Me.ClientRectangle.Width - (btnHashFile.Width + gPadding), lblSourceFile.Top + lblSourceFile.Height + gPadding)
            .Text = &amp;quot;&amp;lt;-- Hash File&amp;quot;
        End With
        With txtSourceFile
            .Location = New System.Drawing.Point(gPadding, lblSourceFile.Top + lblSourceFile.Height + gPadding)
            .Width = Me.ClientRectangle.Width - (gPadding + btnHashFile.Width + (gPadding * 2))
            .Text = String.Empty
            .AllowDrop = True
        End With
        With lblHashResults
            .Location = New System.Drawing.Point(gPadding, txtSourceFile.Top + txtSourceFile.Height + gPadding)
            .Size = New System.Drawing.Size(Me.ClientRectangle.Width - (gPadding * 2), 23)
            .BackColor = Color.SlateGray
            .ForeColor = Color.Orange
            .Font = gLabelFont
            .Text = &amp;quot;Hash Results:&amp;quot;
        End With
        With lvwHashResult
            .Location = New System.Drawing.Point(gPadding, lblHashResults.Top + lblHashResults.Height + gPadding)
            .Size = New System.Drawing.Size(Me.ClientRectangle.Width - (gPadding * 2), 200)
            .View = View.Details
            .GridLines = True
            .FullRowSelect = True
            .MultiSelect = False
            .Scrollable = True
            .Columns.Add(&amp;quot;Byte as Binary&amp;quot;)
            .Columns.Add(&amp;quot;Byte as Decimal&amp;quot;)
            .Columns.Add(&amp;quot;Byte as Hexidecimal&amp;quot;)
            .Columns.Add(&amp;quot;Byte as Character&amp;quot;)
            For Each vCol As ColumnHeader In .Columns
                vCol.Width = Convert.ToInt32((.Width / .Columns.Count) - (24 / .Columns.Count))
            Next
        End With
        With txtHashResult
            .Location = New System.Drawing.Point(gPadding, lvwHashResult.Top + lvwHashResult.Height + gPadding)
            .Width = Me.ClientRectangle.Width - (gPadding * 2)
            .ReadOnly = True
            .Text = String.Empty
        End With
        With Me
            .ClientSize = New System.Drawing.Size(Me.ClientRectangle.Width, txtHashResult.Top + txtHashResult.Height + gPadding)
        End With
    End Sub

    Private Sub txtSourceFile_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtSourceFile.DragEnter
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then
            e.Effect = DragDropEffects.Copy
        End If
    End Sub

    Private Sub txtSourceFile_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtSourceFile.DragDrop
        If e.Data.GetDataPresent(DataFormats.FileDrop) Then
            Dim vDropObject As String
            For Each strDroppedItem As String In CType(e.Data.GetData(DataFormats.FileDrop), String())
                vDropObject = LCase(strDroppedItem.ToString)

                &amp;#39;Is it a file or a directory?
                Dim objDi As New System.IO.DirectoryInfo(vDropObject)
                If objDi.Exists Then

                    &amp;#39;It is a directory.
                    &amp;#39;Dim vFiles() As String
                    &amp;#39;vFiles = System.IO.Directory.GetFiles(vDropObject)
                Else

                    &amp;#39;It is a file.
                    Dim vFi As New System.IO.FileInfo(vDropObject)
                    If vFi.Exists Then
                        txtSourceFile.Text = vFi.FullName
                    End If
                End If
            Next
        End If
    End Sub

    Private Sub btnHashText_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHashText.Click

        &amp;#39;Clear listview.
        lvwHashResult.Items.Clear()
        lblHashResults.Text = &amp;quot;Hash Results:&amp;quot;

        &amp;#39;Compute hash.
        Dim vHashBytes As Byte() = GetHashBytesFromString(txtSourceText.Text, drpHashAlgo.SelectedItem.ToString)

        &amp;#39;If it didn&amp;#39;t work, exit sub.
        If vHashBytes Is Nothing Then
            MsgBox(&amp;quot;Invalid Algorithm Selection or Problem Computing Hash&amp;quot;)
            Exit Sub
        End If

        &amp;#39;Show results.
        ShowResult(vHashBytes)
    End Sub

    Private Sub btnHashFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHashFile.Click

        &amp;#39;Clear listview.
        lvwHashResult.Items.Clear()
        lblHashResults.Text = &amp;quot;Hash Results:&amp;quot;

        &amp;#39;Check if file exists.
        Dim vFile As String = Trim(txtSourceFile.Text)
        If Not Len(vFile) &amp;gt; 0 Then MsgBox(&amp;quot;Invalid file.&amp;quot;) : Exit Sub
        Dim vFi As New System.IO.FileInfo(vFile)
        If Not vFi.Exists Then MsgBox(&amp;quot;Invalid file.&amp;quot;) : Exit Sub

        &amp;#39;Compute hash.
        Dim vHashBytes As Byte() = GetHashBytesFromFile(vFi.FullName, drpHashAlgo.SelectedItem.ToString)

        &amp;#39;If it didn&amp;#39;t work, exit sub.
        If vHashBytes Is Nothing Then
            MsgBox(&amp;quot;Invalid Algorithm Selection or Problem Computing Hash&amp;quot;)
            Exit Sub
        End If

        &amp;#39;Show results.
        ShowResult(vHashBytes)
    End Sub

    Private Sub ShowResult(ByRef pHashBytes As Byte())

        &amp;#39;Collect hexidecimal notation.
        Dim vSb As New System.Text.StringBuilder

        &amp;#39;Populate listview with hash bytes.
        For i As Integer = 0 To pHashBytes.Length - 1
            Dim vLvw As New System.Windows.Forms.ListViewItem
            With vLvw

                &amp;#39;First column (byte as binary)
                .Text = Convert.ToString(pHashBytes(i), 2).PadLeft(8, &amp;quot;0&amp;quot;c)

                &amp;#39;Second column (byte as decimal)
                .SubItems.Add(pHashBytes(i).ToString)

                &amp;#39;Third column (byte as hexidecimal)
                Dim vHex As String = pHashBytes(i).ToString(&amp;quot;X2&amp;quot;)
                vSb.Append(vHex)
                .SubItems.Add(vHex)

                &amp;#39;Fourth column (byte as character)
                .SubItems.Add(ChrW(pHashBytes(i)))
            End With
            lvwHashResult.Items.Add(vLvw)
        Next

        &amp;#39;Show hash as hex string in textbox.
        txtHashResult.Text = LCase(vSb.ToString)

        &amp;#39;Tell how many bytes there are.
        lblHashResults.Text = String.Format(&amp;quot;Hash Results ({0} Bytes):&amp;quot;, pHashBytes.Count)
    End Sub

    Public Function GetHashBytesFromFile(ByVal pSourceFilePath As String, ByVal pAlgo As String) As Byte()
        Dim vDigestBytes As Byte() = Nothing

        Select Case pAlgo
            Case &amp;quot;MD5&amp;quot;
                Using vStream As New System.IO.FileStream(pSourceFilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read, IO.FileShare.Delete)
                    Using vHashProvider As New System.Security.Cryptography.MD5CryptoServiceProvider
                        vDigestBytes = vHashProvider.ComputeHash(vStream)
                    End Using
                End Using
            Case &amp;quot;RIPEMD-160&amp;quot;
                Using vStream As New System.IO.FileStream(pSourceFilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read, IO.FileShare.Delete)
                    Using vHashProvider As New System.Security.Cryptography.RIPEMD160Managed
                        vDigestBytes = vHashProvider.ComputeHash(vStream)
                    End Using
                End Using
            Case &amp;quot;SHA-1&amp;quot;
                Using vStream As New System.IO.FileStream(pSourceFilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read, IO.FileShare.Delete)
                    Using vHashProvider As New System.Security.Cryptography.SHA1CryptoServiceProvider
                        vDigestBytes = vHashProvider.ComputeHash(vStream)
                    End Using
                End Using
            Case &amp;quot;SHA-256&amp;quot;
                Using vStream As New System.IO.FileStream(pSourceFilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read, IO.FileShare.Delete)
                    Using vHashProvider As New System.Security.Cryptography.SHA256CryptoServiceProvider
                        vDigestBytes = vHashProvider.ComputeHash(vStream)
                    End Using
                End Using
            Case &amp;quot;SHA-384&amp;quot;
                Using vStream As New System.IO.FileStream(pSourceFilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read, IO.FileShare.Delete)
                    Using vHashProvider As New System.Security.Cryptography.SHA384CryptoServiceProvider
                        vDigestBytes = vHashProvider.ComputeHash(vStream)
                    End Using
                End Using
            Case &amp;quot;SHA-512&amp;quot;
                Using vStream As New System.IO.FileStream(pSourceFilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read, IO.FileShare.Delete)
                    Using vHashProvider As New System.Security.Cryptography.SHA512CryptoServiceProvider
                        vDigestBytes = vHashProvider.ComputeHash(vStream)
                    End Using
                End Using
        End Select

        Return vDigestBytes
    End Function

    Private Function GetHashBytesFromString(ByVal pSourceText As String, ByVal pAlgo As String) As Byte()
        Dim vDigestBytes As Byte() = Nothing

        Select Case pAlgo
            Case &amp;quot;MD5&amp;quot;
                Using vHashProvider As New System.Security.Cryptography.MD5CryptoServiceProvider
                    vDigestBytes = vHashProvider.ComputeHash(System.Text.Encoding.UTF8.GetBytes(pSourceText))
                End Using
            Case &amp;quot;RIPEMD-160&amp;quot;
                Using vHashProvider As New System.Security.Cryptography.RIPEMD160Managed
                    vDigestBytes = vHashProvider.ComputeHash(System.Text.Encoding.UTF8.GetBytes(pSourceText))
                End Using
            Case &amp;quot;SHA-1&amp;quot;
                Using vHashProvider As New System.Security.Cryptography.SHA1CryptoServiceProvider
                    vDigestBytes = vHashProvider.ComputeHash(System.Text.Encoding.UTF8.GetBytes(pSourceText))
                End Using
            Case &amp;quot;SHA-256&amp;quot;
                Using vHashProvider As New System.Security.Cryptography.SHA256CryptoServiceProvider
                    vDigestBytes = vHashProvider.ComputeHash(System.Text.Encoding.UTF8.GetBytes(pSourceText))
                End Using
            Case &amp;quot;SHA-384&amp;quot;
                Using vHashProvider As New System.Security.Cryptography.SHA384CryptoServiceProvider
                    vDigestBytes = vHashProvider.ComputeHash(System.Text.Encoding.UTF8.GetBytes(pSourceText))
                End Using
            Case &amp;quot;SHA-512&amp;quot;
                Using vHashProvider As New System.Security.Cryptography.SHA512CryptoServiceProvider
                    vDigestBytes = vHashProvider.ComputeHash(System.Text.Encoding.UTF8.GetBytes(pSourceText))
                End Using
        End Select

        Return vDigestBytes
    End Function
End Class
&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;&lt;script language="javascript"&gt;
dp.SyntaxHighlighter.ClipboardSwf = '/dp.SyntaxHighlighter/Scripts/clipboard.swf'
dp.SyntaxHighlighter.HighlightAll('3de45e588b5e409b989b3aa70a9bcd11')
dp.SyntaxHighlighter.HighlightAll('47736d3a2345425aa54bf02e02ca9942')
dp.SyntaxHighlighter.HighlightAll('01711b5ec0f84b1d952570566844cc04')
&lt;/script&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://vbcity.com/aggbug.aspx?PostID=698954" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/LVO0KMc5pl4" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/LVO0KMc5pl4/post.aspx</link>
      <author>VB &amp; .NET Blogs @ vbCity.com - Matt G</author>
      <pubDate>Wed, 22 Dec 2010 06:05:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7670</feedburner:origLink></item>
    <item>
      <title>Beginning Silverlight ~ Media Element</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: VB &amp; .NET Blogs @ vbCity.com&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;p&gt;I touched briefly on the mediaelement in &lt;a target="_blank" href="http://vbcity.com/blogs/canoz/archive/2010/04/24/beginning-silverlight-brushes-3.aspx"&gt;this post&lt;/a&gt; dealing with Image and Video brushes.&amp;nbsp;&amp;nbsp; In this post I will expand a little on using the media element for playing video.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;1. Setting up the Project.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The project is going to start with a 500 x 500 layout root grid with a light gray background.&lt;/p&gt;
&lt;p&gt;&lt;img height="191" width="531" src="http://www.neilknobbe.com/blogimages/01BeginningSilverlightMediaElement.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;While not essential I have also set the vertical and horizontal alignments so that the grid is displayed in the top left corner of the page.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/02BeginningSilverlightMediaElement.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;Into the ClientBin directory of the web project I have added a directory named &amp;ldquo;Video&amp;rdquo; and into that directory I have added a video file.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/03BeginningSilverlightMediaElement.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The reason I didn&amp;rsquo;t add the video to the silverlight project is to keep the size of the published .xap file smaller and thus let the application load quicker.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;2.&amp;nbsp; Adding the MediaElement.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Adding a mediaelement to the project is as simple as dragging the element from the toolbox onto the UserControl or defining it with XAML.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/04BeginningSilverlightMediaElement.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The media element itself is transparent until it is displaying some sort of video so you will not see anything if you were to run the project.&lt;/p&gt;
&lt;p&gt;You don&amp;rsquo;t necessarily need to set a height and width for the mediaelement as it will be restricted in size to the size of its parent element.&amp;nbsp; If you want to give the user the option to make the player larger you can make use of the MaxHeight and MaxWidth attributes to keep the video from being blurred by making it larger than the dimensions of the video itself.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;3.&amp;nbsp; Configuring the MediaElement.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Getting a video to play is a simple process.&amp;nbsp; All you need to do is set the Source attribute.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/05BeginningSilverlightMediaElement.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The default setting for a mediaelement is to automatically start the source video so if you were to run the project the video would start&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/06BeginningSilverlightMediaElement.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;It is important to note that the video would only start right away if you are running your project from your local machine.&amp;nbsp; If you were to run the project from an internet site you would mostly have some delay as the video file is downloaded to your machine from the server.&amp;nbsp; The video would also play and stop as the file is received.&lt;/p&gt;
&lt;p&gt;There are a couple of ways to get around the start and stop playback of the video.&amp;nbsp; One option would be to set the AutoPlay attribute of the media element to False.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/07BeginningSilverlightMediaElement.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The upside of this option would be the file would start to be downloaded without beginning to play.&amp;nbsp; The downside is you would need to expand the project to give the person accessing the page a way to start the video.&lt;/p&gt;
&lt;p&gt;A second option, which would not require a way for someone to start the video, would be to set a BufferingTime.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/08BeginningSilverlightMediaElement.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;Setting the bufferingtime tells the mediaplayer how much of the video must be in the buffer before it will play the video.&amp;nbsp;&amp;nbsp; BufferingTime is defined in the format of Hours:Minutes:Seconds.&amp;nbsp; Depending on how the video is delivered by the server would determine how much time you should have buffered.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;4.&amp;nbsp; Types of Videos.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You are somewhat limited with videos that you can play with the mediaelement.&amp;nbsp; You can see the types of video that the sliverlight mediaelement supports &lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/cc189080(VS.95).aspx"&gt;here from MSDN&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The video must also have frame dimensions that are divisible by 2, so a dimension of 480 x 240 is acceptable but a dimension of 485 x 245 is not.&lt;/p&gt;
&lt;p&gt;There are some applications that you can use to encode your video to the proper format and size.&amp;nbsp; Personally I use &lt;a target="_blank" href="http://www.microsoft.com/expression/products/EncoderPro_Overview.aspx"&gt;Expression Encoder&lt;/a&gt; for encoding videos for the web.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://vbcity.com/aggbug.aspx?PostID=698166" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/vfHqPAmGfyg" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/vfHqPAmGfyg/post.aspx</link>
      <author>VB &amp; .NET Blogs @ vbCity.com - Neil Knobbe</author>
      <pubDate>Sat, 18 Dec 2010 08:47:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7669</feedburner:origLink></item>
    <item>
      <title>A simple stylesheet tester</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: VB &amp; .NET Blogs @ vbCity.com&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;link type="text/css" rel="stylesheet" href="/dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css"&gt;&lt;/link&gt;
&lt;script language="javascript" src="/dp.SyntaxHighlighter/Scripts/shCore.js"&gt;&lt;/script&gt;
&lt;script language="javascript" src="/dp.SyntaxHighlighter/Scripts/shBrushCSharp.js"&gt;&lt;/script&gt;
&lt;p&gt;In this post, I&amp;nbsp;describe how to make&amp;nbsp;a Windows form with a WebBrowser control to show the rendered styles in a stylesheet.&amp;nbsp; The interface is pretty simple.&amp;nbsp; Enter the URL of a stylesheet, press &amp;quot;Go&amp;quot; and you get to see the available styles and what they look like.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://vbcity.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/larryblake/8357.StylesheetTester.png"&gt;&lt;img src="http://vbcity.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/larryblake/8357.StylesheetTester.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There are four controls on this form.&amp;nbsp; Use the &lt;strong&gt;Anchor&lt;/strong&gt; property of the controls so that the window can be maximized and the controls will grow / move appropriately.&amp;nbsp; (To be precise: on the GroupBox, set Anchor&amp;nbsp;to Top,Left,Right.&amp;nbsp;&amp;nbsp;On the TextBox, set it to&amp;nbsp;Top,Left,Right.&amp;nbsp; On the Button, use Top,Right.&amp;nbsp; On the WebBrowser, use Top,Left,Right, Bottom.)&lt;/p&gt;
&lt;p&gt;Then the code is as follows.&amp;nbsp; I&amp;#39;m using C# in this example.&lt;/p&gt;
&lt;p&gt;&lt;pre name="be21167e797c4656b358cadd39213d53" class="C#"&gt;
using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Windows.Forms; 
using System.Net; 
using System.IO; 



namespace StylesheetTester 
{ 
public partial class Form1 : Form 
{ 
    public Form1() 
    { 
        InitializeComponent(); 
    } 

    private void Form1_Load(object sender, EventArgs e) 
    { 
        // Set a default. 
        textBox1.Text = &amp;quot;http://www.vbcity.com/themes/hawaii/style/Common.css&amp;quot;; 
    } 

    private void GetInfo(string styleURL) 
    { 
    try 
        { 
            // Build an HTML page, using the entered stylesheet. 
            StringBuilder sb = new StringBuilder(&amp;quot;&amp;lt;html&amp;gt;&amp;quot;); 
            sb.Append(&amp;quot;&amp;lt;head&amp;gt;&amp;lt;link rel=&amp;#39;stylesheet&amp;#39; type=&amp;#39;text/css&amp;#39; href=&amp;#39;&amp;quot; + styleURL + &amp;quot;&amp;#39; /&amp;gt;&amp;lt;/head&amp;gt;&amp;quot;); 

            // Read the stylesheet as a stream. 
            WebRequest req = WebRequest.Create(new Uri(styleURL)); 
            WebResponse resp = req.GetResponse(); 
            Stream stream = resp.GetResponseStream(); 
            List&amp;lt;string&amp;gt; styles = new List&amp;lt;string&amp;gt;(); 
            using (StreamReader sr = new StreamReader(stream)) 
            { 
                while (!sr.EndOfStream) 
                { 
                      string s = sr.ReadLine(); 
                      // Look for style entries, by taking lines that begin with &amp;quot;.&amp;quot; 
                      // (NOTE: This doesn&amp;#39;t handle all possibilities in CSS.) 
                      if (s.StartsWith(&amp;quot;.&amp;quot;)) 
                     { 
                         string[] ar = s.Split(&amp;#39; &amp;#39;); 
                         string sty = ar[0].Substring(1); 

                         // Add to a list, avoiding duplicates. 
                         if (!styles.Contains(sty)) styles.Add(sty); 
                     } 
                 } 
            } 

            // Show h1, h2, etc. 
          sb.Append(&amp;quot;&amp;lt;body&amp;gt;&amp;lt;table class=&amp;#39;text&amp;#39; border=&amp;#39;0&amp;#39; cellspacing=&amp;#39;0&amp;#39;&amp;gt;&amp;quot;); 
          for (int i = 1; i &amp;lt; 6; i++) 
          { 
                string h = &amp;quot;h&amp;quot; + i.ToString(); 
                sb.Append(&amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot; + h + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;&amp;quot; + h + &amp;quot;&amp;gt;Sample text&amp;lt;/&amp;quot; + h + &amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;); 
          } 

          // Show the style names. Use the CSS class to render the words &amp;quot;Sample text&amp;quot;. 
          foreach (string y in styles) 
          { 
                sb.Append(&amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot; + y + &amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;td class=&amp;#39;&amp;quot; + y + &amp;quot;&amp;#39;&amp;gt;Sample text&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;); 
                sb.Append(&amp;quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;quot;); 
          } 
          sb.Append(&amp;quot;&amp;lt;/table&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&amp;quot;); 
          this.webBrowser1.DocumentText = sb.ToString(); 
    } 

    // Deal with errors. Typically 404 if you enter a bad URL. 
    catch (Exception e) 
    { 
          MessageBox.Show(e.Message); 
    } 
} 

    private void button1_Click(object sender, EventArgs e) 
    { 
        GetInfo(textBox1.Text); 
    } 
} 
}
&lt;/pre&gt; &lt;/p&gt;
&lt;p&gt;This can be expanded, but that&amp;#39;s pretty much it.&lt;/p&gt;&lt;script language="javascript"&gt;
dp.SyntaxHighlighter.ClipboardSwf = '/dp.SyntaxHighlighter/Scripts/clipboard.swf'
dp.SyntaxHighlighter.HighlightAll('be21167e797c4656b358cadd39213d53')
&lt;/script&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://vbcity.com/aggbug.aspx?PostID=698868" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/ryoy5T-kd3Q" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/ryoy5T-kd3Q/post.aspx</link>
      <author>VB &amp; .NET Blogs @ vbCity.com - LarryBlake</author>
      <pubDate>Wed, 15 Dec 2010 23:57:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7668</feedburner:origLink></item>
    <item>
      <title>Beginning Silverlight ~ Shapes</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: VB &amp; .NET Blogs @ vbCity.com&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;p&gt;This post is going to take a quick look at the shapes that are available with Silverlight.&lt;/p&gt;
&lt;p&gt;Silverlight comes with five built in shapes from which you can construct just about any shape that you can imagine.&lt;/p&gt;
&lt;p&gt;The built in shapes are the Ellipse, Line, Polygon, Polyline and Rectange.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.&amp;nbsp; Setting up the Project.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The base project for each shape is going to be the same.&amp;nbsp; The project will consist of a base layout 500 x 500 grid with a light gray background.&amp;nbsp; I have also set the vertical and horizontal alignment.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/01BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;When the project is run, the grid is displayed in the top left of the page.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/02BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;2.&amp;nbsp; The Ellipse.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The ellipse is the shape that is used for creating circles and ovals.&amp;nbsp; The most basic declaration of an ellipse that you can make must include a colour for the Fill attribute.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/03BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t specify a height or width for the ellipse a circle will be displayed and the way that silverlight works the shape will expand to the size of its parent container.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/04BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;If you want an oval shape then you will need to define a height a width, which have different values from each other, for the ellipse.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/05BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/06BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;To extend beyond the plain shape you can also define a colour, width or type of stroke, think of&amp;nbsp;a border, to the ellipse as well.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/07BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The XAML above gives the ellipse a blue border.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/08BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;You are not limited to solid borders either.&amp;nbsp; You can set a style for the stroke as well.&amp;nbsp; Setting the StrokeDashArray gives you an broken looking stroke.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/09BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The first number in the strokedasharray would be the number of pixels that the colour of your stroke will be displayed.&amp;nbsp; The second number is the number of pixels that will have no colour.&amp;nbsp; So running the above XAML you would see the following.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/10BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;You do not have to use only two numbers for the value of the strokedasharray.&amp;nbsp; You can get quite inventive with if you want and use more than two numbers.&amp;nbsp; If you wanted to use three numbers you would just add the number to the array.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/11BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The only thing that you need to remember with using more than two numbers is that the odd numbers in the array (the first, third, fifth etc) will be the number of pixels that show colour and the even numbers in the array (the second, fourth etc) will be the non-coloured pixels.&amp;nbsp; Using the three numbers above you can see that the stroke is much different and you get a mixture of all values as both coloured and non-coloured pixels.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/12BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;3.&amp;nbsp; The Line.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The line shape is, if you will excuse the pun, pretty straight forward.&lt;/p&gt;
&lt;p&gt;To define a line you need to have a colour for the stroke, a set of x and y coordinates(X1 and Y1) for a starting point and a set of x and y coordinates (X2 and Y2) for an ending point.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/13BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;Remembering that the x-axis represents the horizontal distance and the y-axis is the vertical distance. You would get the following.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/14BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;Similar to the stroke in the ellipse example the line can be altered by changing settings of the strokedasharray, strokedashcap and strokedashendlinecap.&amp;nbsp; For example the following XAML;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/15BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;displays a segregated line with points on the ends of each coloured segment and a rounded end for the line.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/16BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;4.&amp;nbsp; The Polygon.&lt;/p&gt;
&lt;p&gt;The polygon shape is used to create shapes of three or more sides though if you are trying to create a square or rectangle then you would be just as well off to use the rectangle shape.&amp;nbsp; I will look into the rectangle later in this post.&lt;/p&gt;
&lt;p&gt;A polygon is defined by adding a series of x and y coordinates which will represent each place that two lines will intersect.&amp;nbsp; The polygon will automatically close itself, or add a stroke from the last point added to the first point, so that the shape is complete.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/17BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;Adding three sets of&amp;nbsp;points as in the XAML above will insert a triangle into the grid.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/18BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;So you can make the polygon as complex as you want.&amp;nbsp; Adding more sets of coordinates to the points array,&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/19BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;creates a shape with more sides.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/20BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;As with all shapes built into silverlight you can add a stroke the polygon and alter it to fit your needs.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;5.&amp;nbsp; The Polyline.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The polyline is a line, but is not used to create a straight line as you do with the line shape. The polyline is made up of several segments that meet at defined points.&amp;nbsp; The polyline is similar to the polygon but where the polygon automatically closes the first and last defined points the polyline does not close the shape.&lt;/p&gt;
&lt;p&gt;The polyline is defined by a series of points, x and y coordinates, that shows where the polyline segments meet.&amp;nbsp; Using the same points as the polygon example above,&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/21BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;you only see the outline of the shape.&amp;nbsp; Also note that the start of the line and end of the line do not automatically join.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/22BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;Again, as with the other shapes in silverlight, you can alter the look of the stroke by changing the values of the attributes pertaining to the stroke.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/23BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;You can see the effects of the XAML above on the polyline in the screen shot below.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/24BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;6.&amp;nbsp; The Rectangle.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The rectangle is used to create either square or rectangular shapes.&lt;/p&gt;
&lt;p&gt;The same way that an ellipse without a defined height and width fills its parent container the rectangle will do that same if it is declared with just a fill colour.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/25BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;You will see that the layout root grid is filled by the rectangle.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/26BeginningSilverlightShapes.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;Once again you can alter the stroke of a rectangle shape as you can with any other silverlight shape by setting values for any of the attributes of the stroke.&amp;nbsp; The attributes are: strokethickness, strokethickness, strokedasharray, strokestartlinecap, stokedashcap, strokeendlinecap, strokelinejoin, strokedashoffset and strokemiterlimit.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://vbcity.com/aggbug.aspx?PostID=698171" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/4lmmtNxpQDo" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/4lmmtNxpQDo/post.aspx</link>
      <author>VB &amp; .NET Blogs @ vbCity.com - Neil Knobbe</author>
      <pubDate>Sat, 11 Dec 2010 02:25:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7667</feedburner:origLink></item>
    <item>
      <title>DXperience v2010 vol 2 Review</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: VB &amp; .NET Blogs @ vbCity.com&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;p&gt;Hi guys, this is my second review of these controls, and it will be quite different than the first.

&lt;/p&gt;
&lt;p&gt;A few months ago I was engaged by a client to develop a web based application. He asked me (I guess they all ask the same) to make it good looking and attractive. The first thing I thought of when I heard this was &lt;strong&gt;&amp;quot;I must renew my DXperience subscription&amp;quot;&lt;/strong&gt;. And now I am glad I did that.

&lt;/p&gt;
&lt;p&gt;Before I continue, I would like to say something to those readers who are totally &lt;strong&gt;new to DXperience&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;Guys, we all know that one of the more frustrating things for the ASP.NET developers is designing the good looking application. Well folks, your troubles are over! The DXperience takes much of the agony out of developing and designing an outstanding web application.

&lt;/p&gt;
&lt;p&gt;Here we go!&lt;/p&gt;
&lt;!--more--&gt;
&lt;p&gt;

&lt;span style="color:#666699;"&gt;&lt;strong&gt;Features:&lt;/strong&gt;&lt;/span&gt; DXperience suite offers much more than you would expect. The suite contains a huge number of controls. Yep it has way more controls than any of the competitors. DXperince offers even a themed button that none of the competition does actually. Most importantly all the controls have an amazing feature set.

&lt;/p&gt;
&lt;p&gt;For instance I love their &lt;strong&gt;Reporting suite&lt;/strong&gt;. Hmm do you believe that I created web stats report with amazing possibilities just in 20 minutes? Please check it out:



&lt;/p&gt;
&lt;p&gt;&lt;img width="619" alt="Reporting Suite" src="http://www.aspneter.com/aspneter/wp-content/uploads/2010/12/AspXReports.gif" height="455" /&gt;&lt;/p&gt;
&lt;p&gt;Yeah you don&amp;rsquo;t need to use outside hit counters and web traffic analysis tools anymore.

&lt;/p&gt;
&lt;p&gt;For instance, using this particular report my customer is able to watch the visitors interact with his web site in real time.  He can generate different reports on weekly, monthly, quarterly and yearly basis using a different chart views. &lt;strong&gt;It&amp;rsquo;s pretty cool. Isn&amp;rsquo;t it?&lt;/strong&gt;

&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also I love the new &lt;strong&gt;News Control&lt;/strong&gt; (AspxNewsControl)&lt;/p&gt;
&lt;p&gt;&lt;img width="707" alt="News Control" src="http://www.aspneter.com/aspneter/wp-content/uploads/2010/12/AspxNewsControl.gif" style="vertical-align:middle;" height="491" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I love it because of its simplicity. You just set the data source and voila it works. Plus I love the small popups that display the entire content when you click the details link. Great control indeed!

&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There are lots of cool controls I left out for the sake of brevity (and it still is probably my longest review to my blog) but, I will certainly review them all in time.

&lt;span style="color:#333399;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#333399;"&gt;&lt;strong&gt;LEARNING CURVE:&lt;/strong&gt;&lt;/span&gt; Possibly the best thing about these controls is the &lt;strong&gt;low learning curve&lt;/strong&gt; and ease of implementation.

&lt;/p&gt;
&lt;p&gt;Unlike the other 3&lt;sup&gt;rd&lt;/sup&gt; party suites that take time to learn,  DXperience controls are so simple compared to the default ASP.NET controls. Most of the competitors have renamed a lot of the class members (methods, events etc.), which is annoying. Most of the newbie&amp;rsquo;s are getting frustrated with this, and it is very understandable. DXperience seems to have much better approach in this sense, so&lt;strong&gt; you have an impression that you are working with the standard ASP.NET controls&lt;/strong&gt;.

&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In order to improve the usability, DXperience controls are separated in different tabs making it easy for users to find wanted control.



&lt;/p&gt;
&lt;p&gt;&lt;img width="298" alt="Toolbox" src="http://www.aspneter.com/aspneter/wp-content/uploads/2010/12/DXperienceToolBox.gif" height="711" /&gt;&lt;/p&gt;
&lt;p&gt;Unfortunately the other vendors have put all the controls into one Tab in the Toolbox so it looks like a big mess.

&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#333399;"&gt;&lt;strong&gt;PRICE:&lt;/strong&gt;&lt;/span&gt; DevExpress as an industry leader offers this amazing toolset &lt;strong&gt;in a very sympathetic way&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;They have a several different subscriptions that allows you to buy one that mostly suites your needs.  All the Subscriptions are offered at a very reasonable price (starting at only $799.99 that includes one year updates, support, online training etc.)

&lt;/p&gt;
&lt;p&gt;Btw, as mentioned, my DXperience subscription was expired so I went forward and renewed it. Actually I asked for a little discount and they gladly gave me one. I cannot reveal how much but, trust me, they were very generous and the price was more than reasonable.

&lt;/p&gt;
&lt;p&gt;Ah I almost forgot. DevExpress is the only who has a&lt;strong&gt; 60-day money back guarantee&lt;/strong&gt;. None of competitors has this option. Generally speaking, the latest version of DXperience further widens the&lt;strong&gt; &lt;/strong&gt;&lt;strong&gt;gap between them and their competition&lt;/strong&gt;&lt;strong&gt;. &lt;/strong&gt;

&lt;span style="color:#333399;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#333399;"&gt;&lt;strong&gt;SUPPORT:&lt;/strong&gt;&lt;/span&gt; DevExpress has the best online documentation (everything is well explained with bunch of examples and demos) &lt;a href="http://www.devexpress.com/Support/OnlineHelp.xml"&gt;http://www.devexpress.com/Support/OnlineHelp.xml&lt;/a&gt; and also the best support system.  &lt;/p&gt;
&lt;p&gt;All your tickets are answered by staff who adopted the very same programming styles to solve the same or similar problems. Therefore you&amp;rsquo;ll be never confused in that sense. Even the Forum helpers use the same programming styles. Maybe you can&amp;rsquo;t see the benefit reading this review but, trust me it&amp;rsquo;s a big deal.

&lt;span style="color:#333399;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#333399;"&gt;&lt;strong&gt;SUMMARY:&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt; &lt;/strong&gt;The DxPerience is a good way to avoid some of the headaches involved with the professional reports, good looking designs and rapid development of your web and win projects.

While not inexpensive, nor able to completely eliminate the programming part, it does provide a much simpler and less irritating way to get things up and running. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have tested all the major 3&lt;sup&gt;rd&lt;/sup&gt; party controls but, these ones are way the better than any other.

&lt;/p&gt;
&lt;p&gt;For further information on buying DXperience please refer their website &lt;a href="http://www.devexpress.com/"&gt;http://www.devexpress.com/&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://vbcity.com/aggbug.aspx?PostID=698628" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/S4UkZsHJbGs" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/S4UkZsHJbGs/post.aspx</link>
      <author>VB &amp; .NET Blogs @ vbCity.com - Kulrom</author>
      <pubDate>Mon, 06 Dec 2010 11:41:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7666</feedburner:origLink></item>
    <item>
      <title>How to drag &amp; drop and resize shapes on a form using the .NET System.Drawing.Graphics namespace (GDI+)</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: VB &amp; .NET Blogs @ vbCity.com&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;link type="text/css" rel="stylesheet" href="/dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css"&gt;&lt;/link&gt;
&lt;script language="javascript" src="/dp.SyntaxHighlighter/Scripts/shCore.js"&gt;&lt;/script&gt;
&lt;script language="javascript" src="/dp.SyntaxHighlighter/Scripts/shBrushVb.js"&gt;&lt;/script&gt;
&lt;p&gt;In this tutorial we will create an interactive interface on a Windows Form that responds to clicks, drags, and drops.&amp;nbsp; The catch is we will not be using any controls at all.&amp;nbsp; Everything will be drawn directly on the Form using the .NET&amp;#39;s System.Drawing.Graphics namespace (GDI+).&lt;/p&gt;
&lt;p&gt;We will draw two hands of cards: a top hand and a bottom hand.&amp;nbsp; Once done, the user will be able to resize the form, as well as the splitter which divides the two hand areas.&amp;nbsp; As a result, the cards displayed in each hand will be resized proportionally.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://zhost.tk/u/05/1.png" width="451" height="404" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://zhost.tk/u/63/2.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://zhost.tk/u/sl/3.png" width="451" height="404" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://zhost.tk/u/o8/4.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The full code is at the end of this post.&amp;nbsp; To crecreate this program on your own machine do the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open your Visual Studio IDE and create a new Windows Forms Application.&amp;nbsp; Name it whatever you want (I used &amp;quot;draggable_cards&amp;quot;).&lt;/li&gt;
&lt;li&gt;In the Solution Explorer sidebar, you should have a form called Form1.vb.&amp;nbsp; Right-click that and select View Code.&lt;/li&gt;
&lt;li&gt;Select all existing text with CTRL+A and hit Delete or Backspace to clear it.&lt;/li&gt;
&lt;li&gt;Copy the full code below and paste it in.&lt;/li&gt;
&lt;li&gt;The program is ready.&amp;nbsp; You can hit F5 or click the green arrow icon to run it.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Since no images are available, the program will just show black rectangles in place of the cards.&amp;nbsp; If you supply images in the correct folder, it will show the card images instead.&amp;nbsp; This is covered at the end of Section 2.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Section 1.&amp;nbsp; The cards.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The following Enum contains a simple list of all the different types of cards we will be using in this program.&amp;nbsp; This is just a list of card names.&amp;nbsp; No other information is stored about the cards is here. &lt;pre name="024f03446e3f4c5eb3fea00a37edad51" class="VB.NET"&gt;
Friend Enum CardNames As Integer
    King_of_Spades
    King_of_Clubs
    King_of_Diamonds
    King_of_Hearts
    &amp;#39;...and more...
End Enum
&lt;/pre&gt; &lt;/p&gt;
&lt;p&gt;&lt;b&gt;Section 2.&amp;nbsp; Storing card information.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;A custom class is used to store information about each card.&amp;nbsp; The idea is that for every card name in the above &lt;b&gt;CardNames&lt;/b&gt; enum, an instance of the following &lt;b&gt;Card&lt;/b&gt; class will be created to store various information about the card.&amp;nbsp; In our case, the &lt;b&gt;Card&lt;/b&gt; class stores the card&amp;#39;s name in &lt;b&gt;gName&lt;/b&gt; and image in &lt;b&gt;gImage&lt;/b&gt;.&lt;/p&gt;
&lt;p&gt;&lt;pre name="1e355c406fc74d128c1613673c6cdb75" class="VB.NET"&gt;
Friend Class Card
    Private gName As CardNames = Nothing
    Private gImage As System.Drawing.Image = Nothing
    Friend Sub New(ByVal Name As CardNames)
        gName = Name
        gImage = LoadImage(Name.ToString.ToLower &amp;amp; &amp;quot;.jpg&amp;quot;)
    End Sub
    Friend ReadOnly Property Name() As CardNames
        Get
            Return gName
        End Get
    End Property
    Friend ReadOnly Property PrintableName() As String
        Get
            Return gName.ToString.Replace(&amp;quot;_&amp;quot;, &amp;quot; &amp;quot;) &amp;#39;or perhaps Environment.NewLine
        End Get
    End Property
    Friend ReadOnly Property Image() As System.Drawing.Image
        Get
            Return gImage
        End Get
    End Property
End Class
&lt;/pre&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As you can see by looking at the properties, you can retrieve the &lt;b&gt;Name&lt;/b&gt; (the Enum item itself), &lt;b&gt;PrintableName&lt;/b&gt; (a textual representation of the name, derived from using the &lt;i&gt;ToString&lt;/i&gt; method), and the &lt;b&gt;Image&lt;/b&gt;.&lt;/p&gt;
&lt;p&gt;If you look at the &lt;i&gt;New()&lt;/i&gt; sub of this class, you can see that instancing it into an object will require a constructor -- a &lt;b&gt;Name&lt;/b&gt;, which should be one of the Enum items in the &lt;b&gt;CardNames&lt;/b&gt; Enum.&amp;nbsp; Once supplied, the image, &lt;b&gt;gName&lt;/b&gt;, is set to the image returned from the &lt;i&gt;LoadImage()&lt;/i&gt; function.&lt;/p&gt;
&lt;p&gt;The &lt;i&gt;LoadImage()&lt;/i&gt; function is shown below and requires a file name, which we get by converting &lt;b&gt;Name&lt;/b&gt; (the Enum item) item to a string, lowercasing it, and concatinating a &amp;quot;.jpg&amp;quot; to the end.&amp;nbsp; Note, we could use any image type; I just hard-coded &amp;quot;.jpg&amp;quot; for simplicity&amp;#39;s sake.&lt;/p&gt;
&lt;p&gt;&lt;pre name="1f8684e94eda40098752a8a45504cb31" class="VB.NET"&gt;
Private gImageDir As String = Environment.CurrentDirectory &amp;amp; &amp;quot;\images&amp;quot;
Friend Function LoadImage(ByVal FileName As String) As System.Drawing.Image
    Dim vImageFromFile As System.Drawing.Image = Nothing
    Dim vFileInfo As New System.IO.FileInfo(gImageDir &amp;amp; &amp;quot;\&amp;quot; &amp;amp; FileName)
    If vFileInfo.Exists Then

        &amp;#39;Try, because who knows if it&amp;#39;s a valid image until we actually attempt to load it.
        Using vFs As New System.IO.FileStream(vFileInfo.FullName, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Delete)
            Try
                vImageFromFile = System.Drawing.Image.FromStream(vFs)
            Catch ex As Exception

                &amp;#39;If it&amp;#39;s invalid, then oh well... I guess we won&amp;#39;t have an image.
                &amp;#39;When the time comes, we&amp;#39;ll draw a black rectangle instead.
                vImageFromFile = Nothing
            End Try
        End Using
    End If
    Return vImageFromFile
End Function
&lt;/pre&gt; &lt;/p&gt;
&lt;p&gt;This function looks in &lt;b&gt;gImageDir&lt;/b&gt;, which unless you change it, will be an &lt;i&gt;images&lt;/i&gt; subfolder within the program executable&amp;#39;s startup folder.&amp;nbsp; If any file exists that is named the same as the supplied &lt;b&gt;FileName&lt;/b&gt; parameter, it will attempt to open it as an image.&amp;nbsp; If it succeeds, it will return that image; if it fails, it will return &lt;i&gt;Nothing&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt;Later in the program, when it comes time to drawing the card&amp;#39;s image, it will check whether the &lt;b&gt;Card&lt;/b&gt; object&amp;#39;s &lt;b&gt;Image&lt;/b&gt; property is &lt;i&gt;Nothing&lt;/i&gt;, or set to an actual image.&amp;nbsp; If &lt;i&gt;Nothing&lt;/i&gt;, it will draw a black rectangle instead of an image of the card.&amp;nbsp; Therefore, for this tutorial, if you create an &lt;i&gt;images&lt;/i&gt; subfolder within the &lt;i&gt;\bin\Debug\&lt;/i&gt; folder or &lt;i&gt;\bin\Release\&lt;/i&gt; folder, and put the following images inside, this tutorial will show images for the cards instead of black rectangles.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://zhost.tk/u/0w/king_of_spades.jpg" title="king_of_spades.jpg" target="_blank"&gt;king_of_spades.jpg&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zhost.tk/u/2c/king_of_clubs.jpg" title="king_of_clubs.jpg" target="_blank"&gt;king_of_clubs.jpg&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zhost.tk/u/zt/king_of_diamonds.jpg" title="king_of_diamonds.jpg" target="_blank"&gt;king_of_diamonds.jpg&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://zhost.tk/u/iu/king_of_hearts.jpg" title="king_of_hearts.jpg" target="_blank"&gt;king_of_hearts.jpg&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;Section 3.&amp;nbsp; Program start.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Each class has several &lt;i&gt;Private&lt;/i&gt; variables defined.&amp;nbsp; Since these variables are defined outside of any subroutines or functions, they are &lt;i&gt;global&lt;/i&gt; within the scope of the class.&amp;nbsp; Since they are declared with the &lt;i&gt;Private&lt;/i&gt; keyword rather than &lt;i&gt;Friend&lt;/i&gt; or &lt;i&gt;Public&lt;/i&gt;, they are not exposed to anything outside of the class.&amp;nbsp; All the classes have globals, but Form1 has the Application&amp;#39;s primary thread of execution, so its globals are valid throughout the entire life of the application.&amp;nbsp; The following information is stored in Form1&amp;#39;s globals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;gAllCards&lt;/b&gt; -- A hashtable (a.k.a an &lt;i&gt;associative array&lt;/i&gt;) that contains Key-Value pairs.&amp;nbsp; The &lt;i&gt;Key&lt;/i&gt; for each item will be an Enum value (an item from the &lt;b&gt;CardNames&lt;/b&gt; Enum) representing the name of the a card.&amp;nbsp; The associated &lt;i&gt;Value&lt;/i&gt; will be an instance of the &lt;b&gt;Card&lt;/b&gt; class, which as discussed above, stores information about each card such its the name and image.&amp;nbsp; The purpose of this hashtable is to simply store all the different cards.&amp;nbsp; If information about a card is required later in the program, that information will be looked up from this hashtable by supplying the name of the card (the &lt;b&gt;CardNames&lt;/b&gt;, the Enum value).&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;gTopHand&lt;/b&gt; and &lt;b&gt;gBottomHand&lt;/b&gt; -- Two instances of the &lt;b&gt;Hand&lt;/b&gt; class which we will discuss later.&amp;nbsp; Each &lt;b&gt;Hand&lt;/b&gt; class contains a list of &lt;b&gt;CardNames&lt;/b&gt; (the Enum items) to store the cards that belong in the hand.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;gLayoutDispInfo&lt;/b&gt; -- An instance of the &lt;b&gt;LayoutDisplayInfo&lt;/b&gt; custom class, which is further down in the code.&amp;nbsp; This class just stores the positions of three rectangles.&amp;nbsp; One for the top hand, one for the bottom hand, and one for the splitter area in the middle, where the user can click and drag to resize the hands.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;gSplitterTop&lt;/b&gt; -- an inter storing the number of pixels from the top of the form&amp;#39;s &lt;b&gt;ClientArea&lt;/b&gt; to where the splitter rectangle&amp;#39;s top should be when &lt;b&gt;gLayoutDispInfo&lt;/b&gt; calculates what the relative tops/heights of the hand rectangles.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;gMousePressed&lt;/b&gt; -- A bool letting us know that the mouse has been pressed.&amp;nbsp; If this bool is true (assuming the click occurred overtop of an area of the screen where a card should be), when the user moves the mouse, a visual of that card should be moved to represent it being dragged by the mouse.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;gCurrentDragLocation&lt;/b&gt; -- A point (X,Y coords) that is updated by the &lt;i&gt;MouseMove()&lt;/i&gt; event when &lt;b&gt;gMousePressed&lt;/b&gt; is true.&amp;nbsp; This point is used by the &lt;i&gt;Paint()&lt;/i&gt; subroutine to draw the image of the card being dragged.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;gPressLocation&lt;/b&gt; -- When the user clicks an area of the screen, it records the location.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;gSelectedCardIndex&lt;/b&gt; -- During the Paint subroutine, when a card is being dragged, it figures out &lt;i&gt;which&lt;/i&gt; card to draw for the drag visual, based on &lt;b&gt;gPressLocation&lt;/b&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;gAlphaImageAttr&lt;/b&gt; -- Stores an image attribute that can be passed into the &lt;i&gt;DrawImage()&lt;/i&gt; method of a &lt;b&gt;System.Drawing.Graphics&lt;/b&gt; object (like the &lt;b&gt;e.Graphics&lt;/b&gt; parameter of the form &lt;i&gt;Paint()&lt;/i&gt; sub) when we want to draw an image with 50% opacity.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When the form loads, the &lt;b&gt;gAllCards&lt;/b&gt; hashtable is populated with items from the &lt;b&gt;CardNames&lt;/b&gt; Enum and corresponding &lt;b&gt;Card&lt;/b&gt; class instances.&amp;nbsp; Doing this loads the images from disk as well, since &lt;b&gt;Card&lt;/b&gt; class does this when it is instanced.&amp;nbsp; The top and bottom hands are also populated, but with Enum items from the &lt;b&gt;CardNames&lt;/b&gt; Enum.&amp;nbsp; To reduce flickering when the &lt;i&gt;Paint()&lt;/i&gt; sub draws, turn on double-buffering with the &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.setstyle%28v=vs.71%29.aspx" title="SetStyle()" target="_blank"&gt;&lt;i&gt;SetStyle()&lt;/i&gt;&lt;/a&gt; method.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Section 4.&amp;nbsp; Program operation.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Basically all cards are drawn whenever the form paints.&amp;nbsp; When the form is resized, it invalidates so as to re-paint.&amp;nbsp; The size of the form&amp;#39;s ClientArea, along with the splitter height, determines the the hand rectangles.&amp;nbsp; In turn, each hand calculates how many cards should be shown based on how many cards there are in the hand, the width-to-height proportion of the card, and the size of the rectangle they are to be displayed in.&amp;nbsp; The height of the hand rectangle determines how large the card should be, and the width of the hand rectangele determines how many cards are shown.&amp;nbsp; If there are more cards than the number of cards that can fit width-wise in the rectangle, a clickable region on the right and left will be drawn that will act as scroll buttons.&lt;/p&gt;
&lt;p&gt;On mouse-click, there aren&amp;#39;t any controls so the user is simply clicing on the form.&amp;nbsp; Based on his click location, we determine which card (or splitter or scroll button) the mouse clicked on, by using the same code used to calculate the rectangles for drawing.&amp;nbsp; Once we see if the mouse location is contained within one of those rectangles, we know the user has clicked in that rectangle.&amp;nbsp; For the scroll buttons, if the left one is clicked, it increments or decrements an integer in the hand (either the top or bottom hand, depending on where the click occurred) called &lt;b&gt;gFirstIndex&lt;/b&gt;.&amp;nbsp; This means that if there are 10 cards (indices 0 through 9), and only 5 of them (indices 0 through 5) can be shown due to the size of the hand rectangle, then if the user clicks the scroll right button, it will increment &lt;b&gt;gFirstIndex&lt;/b&gt; by one so that there are still 5 cards shown, but now they are indices 1 through 6.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Section 5.&amp;nbsp; Full code.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre name="72a5a350e03d4564809f22ca82463395" class="VB.NET"&gt;
Option Strict On

Public Class Form1

    &amp;#39;General.
    Private gAllCards As New Hashtable
    Private gLayoutDispInfo As New LayoutDisplayInfo()
    Private gSplitterTop As Integer = Me.ClientRectangle.Height / 2

    &amp;#39;Hands.
    Private gTopHand As New Hand
    Private gBottomHand As New Hand

    &amp;#39;Dragging &amp;amp; dropping.
    Private gMousePressed As Boolean = False
    Private gPressLocation As System.Drawing.Point = Nothing
    Private gSelectedCardIndex As Integer = 0
    Private gCurrentDragLocation As System.Drawing.Point = Nothing

    &amp;#39;Create alpha channel property of 50% opacity for translucent effect.
    Private gAlphaImageAttr As System.Drawing.Imaging.ImageAttributes = GetAlphaImageAttributes(0.5F)

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        &amp;#39;Define all cards.
        With gAllCards
            .Add(CardNames.King_of_Spades, New Card(CardNames.King_of_Spades))
            .Add(CardNames.King_of_Clubs, New Card(CardNames.King_of_Clubs))
            .Add(CardNames.King_of_Diamonds, New Card(CardNames.King_of_Diamonds))
            .Add(CardNames.King_of_Hearts, New Card(CardNames.King_of_Hearts))
        End With

        &amp;#39;Add cards to the top hand.
        With gTopHand
            .Add(CardNames.King_of_Spades)
            .Add(CardNames.King_of_Clubs)
        End With

        &amp;#39;Add cards to the bottom hand.
        With gBottomHand
            .Add(CardNames.King_of_Diamonds)
            .Add(CardNames.King_of_Hearts)
        End With

        &amp;#39;Set double-buffering so that graphics may be invalidated without causing flickering.
        SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.DoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint, True)
    End Sub

    Private Sub Form1_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
        Me.Invalidate()
    End Sub

    Private Sub ClearCardSelection()
        gSelectedCardIndex = -1
        Me.Text = &amp;quot;SELECTED: None&amp;quot;
    End Sub

    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove

        &amp;#39;Is something being dragged?
        If gMousePressed = True Then

            If gSelectedCardIndex &amp;gt; -1 Then

                &amp;#39;A card is being dragged.
                gCurrentDragLocation = e.Location
                Me.Invalidate()
            Else

                &amp;#39;The splitter is being dragged.
                gSplitterTop = e.Location.Y
                Me.Invalidate()
            End If
        End If
    End Sub

    Private Sub Hand_MouseDown(ByRef Hand As Hand, ByVal Bounds As System.Drawing.Rectangle, ByVal ClickLocation As System.Drawing.Point)

        &amp;#39;Clear any card selection.
        ClearCardSelection()

        &amp;#39;Calculate hand.
        Hand.Calculate(Bounds)

        &amp;#39;Where did user press the mouse button?
        If Hand.ScrollLeftBounds.Contains(ClickLocation) Then

            &amp;#39;User pressed the mouse over the left scroll button.
            Hand.ScrollLeft()
            Me.Invalidate()
        ElseIf Hand.ScrollRightBounds.Contains(ClickLocation) Then

            &amp;#39;User pressed the mouse over the right scroll button.
            Hand.ScrollRight()
            Me.Invalidate()
        Else

            &amp;#39;User pressed the mouse over the card area.  Select whatever card the user is over.
            &amp;#39;To do this we need to figure out the rectangles of each card the same way as if we
            &amp;#39;were drawing them.
            With Hand

                &amp;#39;Are there any cards to draw?
                If .NumToDraw &amp;gt; 0 Then

                    &amp;#39;Track location (left) of cards.
                    Dim vCurrentLeft As Integer = Convert.ToInt32((.PaddedCanvasBounds.Width / 2) - (((.ThumbSize.Width + .Padding) * .NumToDraw) / 2) + (.Padding / 2))

                    &amp;#39;Draw visible cards.
                    For i As Integer = .FirstIndex To .LastIndex &amp;#39;or To .NumToDraw - 1

                        &amp;#39;Card rectangle.
                        Dim vCardRect As New System.Drawing.RectangleF(.PaddedCanvasBounds.Left + vCurrentLeft, .PaddedCanvasBounds.Top, .ThumbSize.Width, .ThumbSize.Height)

                        &amp;#39;Is the click location over this card?
                        If vCardRect.Contains(ClickLocation) Then

                            &amp;#39;Select this card.
                            gSelectedCardIndex = i
                            gPressLocation = ClickLocation

                            &amp;#39;Me.Text = &amp;quot;SELECTED: &amp;quot; &amp;amp; .Card(i).ToString()
                            Me.Text = &amp;quot;SELECTED: &amp;quot; &amp;amp; DirectCast(gAllCards(.Card(i)), Card).PrintableName

                            Exit For
                        End If

                        &amp;#39;Increment location (left) for next card.
                        vCurrentLeft += .ThumbSize.Width + .Padding
                    Next
                End If
            End With
        End If
    End Sub

    Private Sub Hand_MouseUp(ByRef Hand As Hand, ByVal Bounds As System.Drawing.Rectangle, ByVal ClickLocation As System.Drawing.Point, ByRef OtherHand As Hand)

        &amp;#39;Calculate hand.
        Hand.Calculate(Bounds)

        &amp;#39;Where did user release the mouse button?
        If Hand.ScrollLeftBounds.Contains(ClickLocation) Then
            Exit Sub
        ElseIf Hand.ScrollRightBounds.Contains(ClickLocation) Then
            Exit Sub
        Else

            &amp;#39;User released the mouse over the card area.  Is the user currently dragging anything?
            If gSelectedCardIndex &amp;gt; -1 Then

                &amp;#39;Is the location where this card was selected within the current hand&amp;#39;s bounds?
                If Bounds.Contains(gPressLocation) Then

                    &amp;#39;If yes, then the card is being dropped into the same hand from which it was selected.
                    &amp;#39;Don&amp;#39;t do anything; just clear any card selection.
                    Exit Sub
                Else

                    &amp;#39;The user has dropped the card into the other hand&amp;#39;s card area.  Remove the card from
                    &amp;#39;the source hand and add it to the other hand.
                    Dim vCardName As CardNames = OtherHand.Card(gSelectedCardIndex)

                    &amp;#39;===============
                    &amp;#39;Dim vSb As New System.Text.StringBuilder
                    &amp;#39;vSb.AppendLine(&amp;quot;Hand contains the following items:&amp;quot;)
                    &amp;#39;For i As Integer = 0 To Hand.Count - 1
                    &amp;#39;    vSb.AppendLine(&amp;quot;    * &amp;quot; &amp;amp; Hand.Card(i).ToString)
                    &amp;#39;Next
                    &amp;#39;vSb.AppendLine(String.Format(&amp;quot;... is about to get this one added: {0} (index {1})&amp;quot;, vCardName.ToString, gSelectedCardIndex))
                    &amp;#39;MessageBox.Show(vSb.ToString)
                    &amp;#39;===============

                    Hand.Add(vCardName)
                    OtherHand.Remove(gSelectedCardIndex)
                End If
            End If
        End If
    End Sub

    Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown

        &amp;#39;The mouse has been pressed.
        gMousePressed = True

        With gLayoutDispInfo

            &amp;#39;Calculate where the splitter, top, and bottom hands will be layed out.
            .Calculate(Me.ClientRectangle.Size, gSplitterTop)

            &amp;#39;In which hand (or splitter area) did the user click or release the mouse?
            If .SplitterBounds.Contains(e.Location) Then

                &amp;#39;Clear any card selection.
                ClearCardSelection()

                &amp;#39;The mouse has been pressed.
                gMousePressed = True

            ElseIf .TopHandBounds.Contains(e.Location) Then
                Hand_MouseDown(gTopHand, .TopHandBounds, e.Location)
            ElseIf .BottomHandBounds.Contains(e.Location) Then
                Hand_MouseDown(gBottomHand, .BottomHandBounds, e.Location)
            End If
        End With
    End Sub

    Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp

        &amp;#39;The mouse has been released.
        gMousePressed = False

        With gLayoutDispInfo

            &amp;#39;Calculate where the splitter, top, and bottom hands will be layed out.
            .Calculate(Me.ClientRectangle.Size, gSplitterTop)

            &amp;#39;In which hand (or splitter area) did the user click or release the mouse?
            If .SplitterBounds.Contains(e.Location) Then

                &amp;#39;Clear any card selection.
                ClearCardSelection()


            ElseIf .TopHandBounds.Contains(e.Location) Then
                Hand_MouseUp(gTopHand, .TopHandBounds, e.Location, gBottomHand)
            ElseIf .BottomHandBounds.Contains(e.Location) Then
                Hand_MouseUp(gBottomHand, .BottomHandBounds, e.Location, gTopHand)
            End If
        End With

        &amp;#39;We are done with any selection; clear it.
        ClearCardSelection()
        Me.Invalidate()
    End Sub

    Private Sub PaintHand(ByRef Hand As Hand, ByVal Bounds As System.Drawing.Rectangle, ByRef Graphics As System.Drawing.Graphics)
        With Hand
            .Calculate(Bounds)

            &amp;#39;Draw left and right scroll buttons
            Graphics.FillRectangle(New System.Drawing.SolidBrush(.ScrollLeftColor), .ScrollLeftBounds)
            Graphics.FillRectangle(New System.Drawing.SolidBrush(.ScrollRightColor), .ScrollRightBounds)

            &amp;#39;Are there any cards to draw?
            If .NumToDraw &amp;gt; 0 Then

                &amp;#39;Track location (left) of cards.
                Dim vCurrentLeft As Integer = Convert.ToInt32((.PaddedCanvasBounds.Width / 2) - (((.ThumbSize.Width + .Padding) * .NumToDraw) / 2) + (.Padding / 2))

                &amp;#39;Draw visible cards.
                For i As Integer = .FirstIndex To .LastIndex &amp;#39;or To .NumToDraw - 1

                    &amp;#39;Card rectangle.
                    Dim vCardRect As New System.Drawing.RectangleF(.PaddedCanvasBounds.Left + vCurrentLeft, .PaddedCanvasBounds.Top, .ThumbSize.Width, .ThumbSize.Height)

                    &amp;#39;Card image.
                    If DirectCast(gAllCards(.Card(i)), Card).Image IsNot Nothing Then
                        Graphics.DrawImage(DirectCast(gAllCards(.Card(i)), Card).Image, vCardRect)
                    Else
                        Graphics.FillRectangle(Brushes.Black, vCardRect)
                    End If

                    &amp;#39;Card text.
                    Dim vText As String = DirectCast(gAllCards(.Card(i)), Card).PrintableName
                    Dim vFont As New System.Drawing.Font(System.Drawing.FontFamily.GenericSansSerif, 10.0F, FontStyle.Bold, GraphicsUnit.Point)
                    Dim vSize As System.Drawing.SizeF = Graphics.MeasureString(vText, vFont, .ThumbSize)
                    Graphics.DrawString(vText, vFont, Brushes.Crimson, vCardRect.Left + (vCardRect.Width - vSize.Width) / 2, vCardRect.Top + (vCardRect.Height - vSize.Height) / 2)

                    &amp;#39;Increment location (left) for next card.
                    vCurrentLeft += .ThumbSize.Width + .Padding
                Next
            End If
        End With
    End Sub

    Private Sub PaintDragCard(ByRef Graphics As System.Drawing.Graphics)

        &amp;#39;Come up with drag rectangle location and size.
        Dim vDragRect As System.Drawing.Rectangle = Nothing

        &amp;#39;We just need either hand to get the thumbnail size.
        With gTopHand.ThumbSize
            vDragRect = New System.Drawing.Rectangle(gCurrentDragLocation.X - Convert.ToInt32(.Width / 2), gCurrentDragLocation.Y - Convert.ToInt32(.Height / 2), .Width, .Height)
        End With

        &amp;#39;Get drag image.
        Dim vDragImage As System.Drawing.Image = Nothing
        With gLayoutDispInfo
            If .TopHandBounds.Contains(gPressLocation) Then
                vDragImage = DirectCast(gAllCards(gTopHand.Card(gSelectedCardIndex)), Card).Image
            ElseIf .BottomHandBounds.Contains(gPressLocation) Then
                vDragImage = DirectCast(gAllCards(gBottomHand.Card(gSelectedCardIndex)), Card).Image
            End If
        End With

        &amp;#39;Paint drag image.
        If vDragImage IsNot Nothing Then

            &amp;#39;Draw image with transparency (gives &amp;quot;out of memory&amp;quot; exception on some computers).
            Graphics.DrawImage(vDragImage, vDragRect, 0, 0, vDragImage.Width, vDragImage.Height, GraphicsUnit.Pixel, gAlphaImageAttr)

            &amp;#39;Draw image without transparency (if the above has an error).
            &amp;#39;Graphics.DrawImage(vDragImage, vDragRect, 0, 0, vDragImage.Width, vDragImage.Height, GraphicsUnit.Pixel)
        Else

            &amp;#39;No image available.  Use filled shape with 50% opacity for translucent effect.
            Dim vColor As System.Drawing.Color = Color.Black
            Dim vBrush = New System.Drawing.SolidBrush(Color.FromArgb(128, vColor.R, vColor.G, vColor.B))

            &amp;#39;Draw shape.
            Graphics.FillRectangle(vBrush, vDragRect)
        End If
    End Sub

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        With gLayoutDispInfo

            &amp;#39;Calculate where the splitter, top, and bottom hands will be layed out.
            .Calculate(Me.ClientRectangle.Size, gSplitterTop)

            &amp;#39;Draw splitter.
            e.Graphics.FillRectangle(Brushes.DarkKhaki, .SplitterBounds)

            &amp;#39;Paint top hand.
            PaintHand(gTopHand, .TopHandBounds, e.Graphics)

            &amp;#39;Paint bottom hand.
            PaintHand(gBottomHand, .BottomHandBounds, e.Graphics)

            &amp;#39;Is a card being dragged?
            If gMousePressed = True And gSelectedCardIndex &amp;gt; -1 Then
                PaintDragCard(e.Graphics)
            End If
        End With
    End Sub
End Class

Friend Class LayoutDisplayInfo

    &amp;#39;Configurable variables and default values.
    Private gSplitterGrabSize As Integer = 10

    &amp;#39;Calculated variables.
    Private gSplitterBounds As System.Drawing.Rectangle = Nothing
    Private gTopHandBounds As System.Drawing.Rectangle = Nothing
    Private gBottomHandBounds As System.Drawing.Rectangle = Nothing
    Friend Sub Calculate(ByVal CanvasSize As System.Drawing.Size, ByVal SplitterTop As Integer)
        gSplitterBounds = New System.Drawing.Rectangle(0, SplitterTop - Convert.ToInt32(gSplitterGrabSize / 2), CanvasSize.Width, gSplitterGrabSize)
        gTopHandBounds = New System.Drawing.Rectangle(0, 0, CanvasSize.Width, gSplitterBounds.Top)
        gBottomHandBounds = New System.Drawing.Rectangle(0, gSplitterBounds.Top + gSplitterGrabSize, CanvasSize.Width, CanvasSize.Height - (gSplitterBounds.Top + gSplitterGrabSize))
    End Sub
    Friend ReadOnly Property SplitterBounds() As System.Drawing.Rectangle
        Get
            Return gSplitterBounds
        End Get
    End Property
    Friend ReadOnly Property TopHandBounds() As System.Drawing.Rectangle
        Get
            Return gTopHandBounds
        End Get
    End Property
    Friend ReadOnly Property BottomHandBounds() As System.Drawing.Rectangle
        Get
            Return gBottomHandBounds
        End Get
    End Property
End Class

Friend Class Hand

    &amp;#39;Configurable variables and default values.
    Private gPadding As Integer = 3
    Private gCardSize As New System.Drawing.Size(284, 400) &amp;#39;This will determine the width-to-height proportionality of the card.
    Private gScrollButtonWidth As Integer = 20
    Private gScrollButtonEnabledColor As System.Drawing.Color = System.Drawing.Color.Lime
    Private gScrollButtonDisabledColor As System.Drawing.Color = System.Drawing.Color.LightGray
    Friend Property Padding() As Integer
        Get
            Return gPadding
        End Get
        Set(ByVal value As Integer)
            gPadding = value
        End Set
    End Property
    Friend Property CardSize() As System.Drawing.Size
        Get
            Return gCardSize
        End Get
        Set(ByVal value As System.Drawing.Size)
            gCardSize = value
        End Set
    End Property
    Friend Property ScrollButtonWidth() As Integer
        Get
            Return gScrollButtonWidth
        End Get
        Set(ByVal value As Integer)
            gScrollButtonWidth = value
        End Set
    End Property
    Friend Property ScrollButtonEnabledColor() As System.Drawing.Color
        Get
            Return gScrollButtonEnabledColor
        End Get
        Set(ByVal value As System.Drawing.Color)
            gScrollBut&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/Z4P9maNsLNc" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/Z4P9maNsLNc/post.aspx</link>
      <author>VB &amp; .NET Blogs @ vbCity.com - Matt G</author>
      <pubDate>Mon, 06 Dec 2010 02:51:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7665</feedburner:origLink></item>
    <item>
      <title>Beginning Silverlight ~ Effects</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: VB &amp; .NET Blogs @ vbCity.com&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;p&gt;Seeing &lt;a target="_blank" href="http://vbcity.com/blogs/xtab/archive/2010/10/18/how-to-create-shadowed-text-in-windows-forms.aspx"&gt;this post&lt;/a&gt; recently by Ged (&lt;a target="_blank" href="http://vbcity.com/"&gt;vbCity&lt;/a&gt; Administrator, Microsoft MVP and all around good guy), it reminded me how easy it was to add a similar effect to Silverlight elements.&lt;/p&gt;
&lt;p&gt;Silverlight comes with two built in effects that you can use on just about any Silverlight element.&amp;nbsp; The effects are the DropShadowEffect and BlurEffect.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.&amp;nbsp;Setting up the Project.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The project consists of a 500 x 500 UserControl.&amp;nbsp;&amp;nbsp; The base layout of the usercontrol is a grid with a light gray background.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/01BeginningSilverlightEffects.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;If the project is run at this point you would see the following, rather unspectacular, result.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/02BeginningSilverlightEffects.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;2.&amp;nbsp; The DropShadowEffect.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Adding a dropshadow makes element look like it is sitting off the page and gives a semi-3D look to the element.&lt;br /&gt;&lt;br /&gt;Staying with the same idea as &lt;a target="_blank" href="http://vbcity.com/blogs/xtab/archive/2010/10/18/how-to-create-shadowed-text-in-windows-forms.aspx"&gt;Ged&amp;#39;s post&lt;/a&gt;, a TextBlock will be added to the base grid.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/03BeginningSilverlightEffects.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;With this example the effect is going to be added as part of the XAML definition of the textblock.&amp;nbsp; The effect could also be defined as a Resource by either defining an effect itself or as part of a style for an element.&amp;nbsp; The effect could also be applied via code behind if you so wished.&lt;/p&gt;
&lt;p&gt;At its most basic all you need to do to get a dropshadoweffect is to add a plain definition for the effect.&amp;nbsp;&amp;nbsp; The default values for Color, ShadowDepth and Direction are used.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/04BeginningSilverlightEffects.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;Running the project you now have a basic dropshadow on the textblock.&lt;/p&gt;
&lt;p&gt;&lt;img height="138" width="388" src="http://www.neilknobbe.com/blogimages/05BeginningSilverlightEffects.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;2a.&amp;nbsp; Customizing the DropShadowEffect.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You can also extend the definition of the dropshadoweffect to customize it a little more if your needs require it.&amp;nbsp; The attributes you can chance are the Color, Direction, Opacity and ShadowDepth.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;:&amp;nbsp; So this effect would be more visible, I did change the HorizontalAlignment of the textblock so it would be centred in the grid.&amp;nbsp; The XAML for the textblock now looks like the following image.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/08BeginningSilverlightEffects.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;By adding values to the four attributes of the dropshadoweffect&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/06BeginningSilverlightEffects.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;a completely different result is seen.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/07BeginningSilverlightEffects.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The color and opacity attributes are straight forward and don&amp;rsquo;t need explaining.&amp;nbsp; The shadowdepth is the distance from the element that the shadow is displayed.&lt;/p&gt;
&lt;p&gt;The direction can be a little confusing.&amp;nbsp; The direction takes a value from 0 to 360 starting at the right of the element and moving in a counter-clockwise direction.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/09BeginningSilverlightEffects.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;3.&amp;nbsp; The BlurEffect.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Adding a blureffect to an element makes the element look like it is out of focus.&amp;nbsp; The more blurring you add to the element the more out of focus it becomes&lt;/p&gt;
&lt;p&gt;Using a textblock again you can add a basic blureffect by just adding the definition for the effect.&amp;nbsp; By default the radius for the blureffect is set at 5.&amp;nbsp;&amp;nbsp; (&lt;strong&gt;Note&lt;/strong&gt;:&amp;nbsp; I have changed the foreground of the textblock to red so the blureffect is more visible.)&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/10BeginningSilverlightEffects.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;When you run the project the whole textblock is now blurry.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/11BeginningSilverlightEffects.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;3a.&amp;nbsp; Customizing the BlurEffect.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;There is only one attribute of the blureffect that you can chanage as that is the radius.&amp;nbsp; The higher the value for the radius the more out of focus the element will be.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/12BeginningSilverlightEffects.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;You can see the results of setting the radius to 15 in the following image.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.neilknobbe.com/blogimages/13BeginningSilverlightEffects.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;So you can see with a simple line of XAML you can easily add a couple of different effects to elements in your Silverlight application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://vbcity.com/aggbug.aspx?PostID=697967" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/FtIs7BVIO-c" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/FtIs7BVIO-c/post.aspx</link>
      <author>VB &amp; .NET Blogs @ vbCity.com - Neil Knobbe</author>
      <pubDate>Sat, 04 Dec 2010 08:27:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7664</feedburner:origLink></item>
    <item>
      <title>Go Live License - Windows Phone 7 for Visual Basic</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: Mike McIntyre&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Download it now at:&amp;nbsp; Windows Phone 7 RTW for Visual Basic&lt;/span&gt;&lt;/p&gt;...(&lt;a href="http://vbcity.com/blogs/mike-mcintyre/archive/2010/11/28/go-live-license-windows-phone-7-for-visual-basic.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://vbcity.com/aggbug.aspx?PostID=698439" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/e_dNEu7kDqY" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/e_dNEu7kDqY/post.aspx</link>
      <author>Mike McIntyre - Mike McIntyre</author>
      <pubDate>Sun, 28 Nov 2010 15:07:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7663</feedburner:origLink></item>
    <item>
      <title>Visual Basic Windows Forms ListBox Right Click Item to Select</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: Mike McIntyre&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;p&gt;I was given this requirement for a Visual Basic application I am creating: When a user right clicks an item in a Windows Forms ListBox, select the item. &lt;/p&gt;
&lt;p&gt;Luckily I quickly found an example... &lt;/p&gt;...(&lt;a href="http://vbcity.com/blogs/mike-mcintyre/archive/2010/11/29/visual-basic-windows-forms-listbox-right-click-item-to-select.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://vbcity.com/aggbug.aspx?PostID=698443" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/Qdzh3_6SZi8" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/Qdzh3_6SZi8/post.aspx</link>
      <author>Mike McIntyre - Mike McIntyre</author>
      <pubDate>Mon, 29 Nov 2010 17:21:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7661</feedburner:origLink></item>
    <item>
      <title>Windows Forms Cursors without cursing</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: XTab (Ged Mead)&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;p&gt;We all pretty much take cursors for granted, don’t we?&amp;#160; You wave your mouse about and the cursor obligingly follows.&amp;#160; Easy.&amp;#160;&amp;#160; But what happens if you want to take control of the cursor?&amp;#160; Sometimes it’s not quite so easy.&amp;#160; Based on problems I’ve seen raised in the past few years, here are a few techniques you might find useful when it comes to dealing with the cursor.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;u&gt;Cursor on a Windows Form      &lt;br /&gt;&lt;/u&gt;This is fairly straightforward.&amp;#160; Let’s start with the case where you want to know the position of the cursor when the user clicks on the form.&amp;#160; &lt;/p&gt;  &lt;p&gt;The Cursor – or Windows.Forms.Cursor&amp;#160; to give it its proper name – has a useful property named Position.&amp;#160; This returns a System.Drawing.Point.&amp;#160; And that point has two values – x and y.&lt;/p&gt;  &lt;p&gt;The x value represents the number of pixels from the left edge of the form, and the y value represents the number of pixels down from the top.&amp;#160; &lt;/p&gt;  &lt;p&gt;So to get the value of that mouse click, you can use code like the following:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div style="font-family:consolas;background:white;color:black;font-size:10pt;"&gt;   &lt;p style="margin:0px;"&gt;&amp;#160; &lt;span style="color:blue;"&gt;Private&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt; Form1_MouseDown(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; sender &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Object&lt;/span&gt;, &lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; e &lt;span style="color:blue;"&gt;As&lt;/span&gt; System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;MouseEventArgs&lt;/span&gt;)&lt;span style="color:blue;"&gt;&amp;#160; &lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Handles&lt;/span&gt;&lt;span style="color:blue;"&gt; Me&lt;/span&gt;.MouseDown&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;Dim&lt;/span&gt; pt &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Point&lt;/span&gt; = Cursor.Position&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:#2b91af;"&gt;Console&lt;/span&gt;.WriteLine(pt.ToString)&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160; &lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;div style="font-family:consolas;background:white;color:black;font-size:10pt;"&gt;   &lt;p style="margin:0px;"&gt;&amp;#160; &lt;/p&gt; &lt;/div&gt;  &lt;p&gt;This will return the two locations of the point, i.e. the x and y:&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {X=661,Y=281}&lt;/p&gt;  &lt;p&gt;Most often you’ll want the x and y values separately, so a better call would be:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div style="font-family:consolas;background:white;color:black;font-size:10pt;"&gt;   &lt;p style="margin:0px;"&gt;&amp;#160; &lt;span style="color:blue;"&gt;Private&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt; Form1_MouseDown(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; sender &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Object&lt;/span&gt;, &lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; e &lt;span style="color:blue;"&gt;As&lt;/span&gt; System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;MouseEventArgs&lt;/span&gt;)&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;Handles&lt;/span&gt; &lt;span style="color:blue;"&gt;Me&lt;/span&gt;.MouseDown&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:#2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Mouse clicked on Form at position {0} / {1}&amp;quot;&lt;/span&gt;, Cursor.Position.X, Cursor.Position.Y) &lt;span style="color:blue;"&gt;&amp;#160; &lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;#160; End&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;where you’ll get two separate values:&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Mouse clicked on Form at position 721 / 480&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;u&gt;Moving cursor to a new location on the screen      &lt;br /&gt;&lt;/u&gt;Try this code in a button click to move the cursor to a pre-selected position:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div style="font-family:consolas;background:white;color:black;font-size:10pt;"&gt;   &lt;p style="margin:0px;"&gt;&amp;#160; &lt;span style="color:blue;"&gt;Private&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt; Button1_Click(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; sender &lt;span style="color:blue;"&gt;As&lt;/span&gt; System.&lt;span style="color:#2b91af;"&gt;Object&lt;/span&gt;, &lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; e &lt;span style="color:blue;"&gt;As&lt;/span&gt; System.&lt;span style="color:#2b91af;"&gt;EventArgs&lt;/span&gt;) &lt;span style="color:blue;"&gt;Handles&lt;/span&gt; Button1.Click&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; Cursor.Position = &lt;span style="color:blue;"&gt;New&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Point&lt;/span&gt;(25, 25)&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160; &lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;When you run it, the cursor will move to point 25,25 on the screen.&amp;#160; There’s the key phrase, though – &lt;em&gt;on the screen.&lt;/em&gt;&amp;#160; Even though you think you’re working with the Windows.Forms.Cursor, the mouse cursor looks at the system wide situation and it will place the cursor up at the top left of the screen.&amp;#160; Now of course if you’re in full screen mode or you’ve specifically placed the form with its top left corner at 0,0 then this will work fine. But if this isn’t the situation, then you need a rethink.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Moving cursor to a new location on the Form      &lt;br /&gt;&lt;/u&gt;What you have to do is restrict the cursor to work within the bounds of the form, not the screen.&amp;#160; And once again there’s a handy little property that you probably wouldn’t have thought of right away (well, at least I didn’t!), and that’s the Clip property.&amp;#160; What this does is that defines a rectangle beyond which the cursor mustn’t look.&amp;#160; So if you set this bounding rectangle to the area of the form, then of course the point will be restricted to the form area.&lt;/p&gt;  &lt;p&gt;Here’s the code that’ll do the trick:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div style="font-family:consolas;background:white;color:black;font-size:10pt;"&gt;   &lt;p style="margin:0px;"&gt;&amp;#160; &lt;span style="color:blue;"&gt;Private&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt; Button2_Click(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; sender &lt;span style="color:blue;"&gt;As&lt;/span&gt; System.&lt;span style="color:#2b91af;"&gt;Object&lt;/span&gt;, &lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; e &lt;span style="color:blue;"&gt;As&lt;/span&gt; System.&lt;span style="color:#2b91af;"&gt;EventArgs&lt;/span&gt;) &lt;span style="color:blue;"&gt;Handles&lt;/span&gt; Button2.Click&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;Me&lt;/span&gt;.Cursor = &lt;span style="color:blue;"&gt;New&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Cursor&lt;/span&gt;(Cursor.Current.Handle)&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; Cursor.Position = &lt;span style="color:blue;"&gt;New&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Point&lt;/span&gt;(Cursor.Position.X + 30, 490)&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; Cursor.Clip = &lt;span style="color:blue;"&gt;New&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Rectangle&lt;/span&gt;(&lt;span style="color:blue;"&gt;Me&lt;/span&gt;.Location, &lt;span style="color:blue;"&gt;Me&lt;/span&gt;.Size)&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160; &lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;As you can see, first it grabs the handle of the current cursor, and then it sets the new position. Finally, it clips the area within which the cursor can operate.&amp;#160; This is definitely one of those “easy when you know it” techniques, that’s really frustrating if you don’t!&lt;/p&gt;  &lt;p&gt;If you need simply to move the cursor to a new location on the form relative to its current location, then the code’s much easier.&amp;#160; You only need to add (or subtract) the number of pixels you want to move horizontally and vertically:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div style="font-family:consolas;background:white;color:black;font-size:10pt;"&gt;   &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160; Cursor.Position = &lt;span style="color:blue;"&gt;New&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Point&lt;/span&gt;(Cursor.Position.X + 30, Cursor.Position.Y + 30)&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;   &lt;br /&gt;&lt;u&gt;Identifying the cursor location in a control      &lt;br /&gt;&lt;/u&gt;The last scenario I want to cover is where the user clicks on a control, such as a PictureBox, and you want to know the x and y values within the PictureBox, not the form.&amp;#160;&amp;#160; The way to work this one is to use the PointToClient method of the PictureBox (or other control, if necessary).&amp;#160; This method will take any specified location on the screen and set this in context of the control that lies at that point.&amp;#160; So, when you click on the PictureBox, PointToClient takes the screen locations, and works out where the Windows Form sits within the screen and where the PictureBox sits within the form.&amp;#160; It then does a quick bit of math and returns a value that represents the number of pixels from the left and top of the control to the cursor’s current location.&amp;#160; (This usually being a point where you’ve clicked in the control, although it doesn’t have to be.&amp;#160; If the cursor is static and you have some way of firing the event without moving the cursor, you’ll still get those values back.&lt;/p&gt;  &lt;p&gt;Here’s the code:&lt;/p&gt;  &lt;div style="font-family:consolas;background:white;color:black;font-size:10pt;"&gt;   &lt;p style="margin:0px;"&gt;&amp;#160; &lt;span style="color:blue;"&gt;Private&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt; PictureBox1_Click(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; sender &lt;span style="color:blue;"&gt;As&lt;/span&gt; System.&lt;span style="color:#2b91af;"&gt;Object&lt;/span&gt;, &lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; e &lt;span style="color:blue;"&gt;As&lt;/span&gt; System.&lt;span style="color:#2b91af;"&gt;EventArgs&lt;/span&gt;) &lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;Handles&lt;/span&gt; PictureBox1.Click&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; PicBoxCursorPosition = &lt;span style="color:blue;"&gt;Me&lt;/span&gt;.PictureBox1.PointToClient(Cursor.Position)&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:#2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515;"&gt;&amp;quot;Mouse clicked on Picture Box at position {0} / {1}&amp;quot;&lt;/span&gt;,&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PicBoxCursorPosition.X, PicBoxCursorPosition.Y)&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;#160; &lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;So there you are, a few quick fixes for frustration free cursor control.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://vbcity.com/aggbug.aspx?PostID=698381" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/A39pmbVhkGM" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/A39pmbVhkGM/post.aspx</link>
      <author>XTab (Ged Mead) - Ged Mead</author>
      <pubDate>Mon, 29 Nov 2010 17:19:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7658</feedburner:origLink></item>
    <item>
      <title>VB Goes Mobile: Announcing “Visual Basic for Windows Phone Developer Tools - RTW"</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: The Visual Basic Team&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;With the release of &lt;/span&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=189554"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Windows Phone Developer Tools&lt;/span&gt;&lt;/a&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt; in September, and the availability of Windows Phone 7 devices in stores, the Windows Phone platform is growing. Today marks another milestone in the progression of Windows Phone. Today we are announcing &lt;/span&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkId=206790&amp;amp;clcid=0x409"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Visual Basic for Windows Phone Developer Tools - RTW&lt;/span&gt;&lt;/a&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;. This release doubles the developer audience for Windows Phone, by enabling Visual Basic developers to create applications for Windows Phone, as well as C#. Please stay tuned for the following announcements and walkthroughs going live today:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://create.msdn.com/en-US/vbrtm"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;App Hub Announcement&lt;/span&gt;&lt;/a&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://windowsteamblog.com/windows_phone/b/wpdev/"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Windows Phone Developer Blog Announcement&lt;/span&gt;&lt;/a&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/somasegar/archive/2010/09/23/windows-phone-vb-developers-great-mobile-apps.aspx"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;S. Somasegar Blog Announcement&lt;/span&gt;&lt;/a&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/jasonz/archive/2010/11/29/announcing-visual-basic-windows-phone-7-support-rtw.aspx"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Jason Zander Blog Announcement&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blogs.msdn.com/b/visualstudio/"&gt;Visual Studio Blog Announcement&lt;/a&gt;&amp;nbsp; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;We released a preview of this VB support in September with the &lt;/span&gt;&lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a808a69d-6119-47b7-b858-262be5c49915&amp;amp;displaylang=en"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Visual Basic CTP for Windows Phone Developer Tools&lt;/span&gt;&lt;/a&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;, and received some great feedback. Unlike the CTP, the RTW release provides &amp;ldquo;Go Live&amp;rdquo; support, which allows Visual Basic developers to submit their applications to the Windows Phone Marketplace! This new capability makes it a *very* exciting release, and we are looking forward to seeing what VB applications you start selling. Another improvement upon the CTP is that the RTW release is now available in all languages that Windows Phone Developer Tools support: English, French, German, Spanish and Italian. Please find the relevant download links for each of these versions below:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;English: &lt;/span&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkId=206790&amp;amp;clcid=0x409"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;http://go.microsoft.com/fwlink/?LinkId=206790&amp;amp;clcid=0x409&lt;/span&gt;&lt;/a&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;French: &lt;/span&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=206790&amp;amp;clcid=0x40c"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;http://go.microsoft.com/fwlink/?LinkID=206790&amp;amp;clcid=0x40c&lt;/span&gt;&lt;/a&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;German: &lt;/span&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=206790&amp;amp;clcid=0x407"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;http://go.microsoft.com/fwlink/?LinkID=206790&amp;amp;clcid=0x407&lt;/span&gt;&lt;/a&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Italian: &lt;/span&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=206790&amp;amp;clcid=0x410"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;http://go.microsoft.com/fwlink/?LinkID=206790&amp;amp;clcid=0x410&lt;/span&gt;&lt;/a&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Spanish: &lt;/span&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=206790&amp;amp;clcid=0x40a"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;http://go.microsoft.com/fwlink/?LinkID=206790&amp;amp;clcid=0x40a&lt;/span&gt;&lt;/a&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt; &lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;i&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;NOTE: Please make sure that you have the pre-requisites installed, before downloading this release! Pre-requisites include Visual Studio 2010 (Professional, Premium and Ultimate), as well as the &lt;/span&gt;&lt;/i&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkID=189554"&gt;&lt;i&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Windows Phone Developer Tools&lt;/span&gt;&lt;/i&gt;&lt;/a&gt;&lt;i&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;. You can find a list of known issues &lt;/span&gt;&lt;/i&gt;&lt;a href="http://download.microsoft.com/download/9/D/5/9D5C6680-C791-4E36-AB35-2EB5FF10A6D9/README.txt"&gt;&lt;i&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;here&lt;/span&gt;&lt;/i&gt;&lt;/a&gt;&lt;i&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;.&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Here&amp;rsquo;s a screenshot of a VB Windows Phone 7 app, using the new release:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-35-13-metablogapi/2330.clip_5F00_image002_5F00_589692EE.jpg"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;&lt;/span&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-35-13-metablogapi/6646.clip_5F00_image002_5F00_4BF8C005.jpg"&gt;&lt;img height="452" width="504" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-35-13-metablogapi/8713.clip_5F00_image002_5F00_thumb_5F00_605273C2.jpg" alt="clip_image002" border="0" title="clip_image002" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /&gt;&lt;/a&gt;&lt;a&gt;&lt;/a&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Are you ready to start building your own VB Windows Phone 7 applications? Be sure to check out the &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ff431744(VS.92).aspx"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Visual Basic Code Samples for Windows Phone on MSDN&lt;/span&gt;&lt;/a&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt; for some examples.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Have a question? Please post to the following forums:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;&amp;middot; &lt;/span&gt;&lt;a href="http://forums.silverlight.net/forums/63.aspx"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Silverlight for Windows Phone Forum&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;&amp;middot; &lt;/span&gt;&lt;a href="http://forums.create.msdn.com/forums/98.aspx"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Windows Phone 7 Development Forum on App Hub&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;We look forward to seeing your VB apps on the &lt;/span&gt;&lt;a href="http://create.msdn.com"&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;Windows Phone Marketplace&lt;/span&gt;&lt;/a&gt;&lt;span style="FONT-FAMILY: ; FONT-SIZE: x-small"&gt;! &lt;/span&gt;&lt;/p&gt;
&lt;div class="wlWriterHeaderFooter" style="margin:0px; padding:0px 0px 0px 0px;"&gt;&lt;br /&gt;&lt;br /&gt;
&lt;script type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="http://tweetmeme.com/i/scripts/button.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10097762" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/zlyLG1G8mfk" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/zlyLG1G8mfk/post.aspx</link>
      <author>The Visual Basic Team - VBTeam</author>
      <pubDate>Mon, 29 Nov 2010 14:51:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7657</feedburner:origLink></item>
    <item>
      <title>Visual Basic Code Samples for Windows Phone 7</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: Mike McIntyre&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;p style="margin-left:1pt;"&gt;&lt;span style="color:black;font-family:Verdana;font-size:10pt;"&gt;Looking for Windows Phone 7 code examples for VB.Net? Checkout this MSDN page:&lt;/span&gt;&lt;/p&gt;...(&lt;a href="http://vbcity.com/blogs/mike-mcintyre/archive/2010/11/28/visual-basic-code-samples-for-windows-phone-7.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://vbcity.com/aggbug.aspx?PostID=698441" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/8-RTe2yL87Q" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/8-RTe2yL87Q/post.aspx</link>
      <author>Mike McIntyre - Mike McIntyre</author>
      <pubDate>Sun, 28 Nov 2010 15:42:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7656</feedburner:origLink></item>
    <item>
      <title>Simple Vertical Text Box Control</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: Mike McIntyre&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;link type="text/css" rel="stylesheet" href="/dp.SyntaxHighlighter/Styles/SyntaxHighlighter.css"&gt;&lt;/link&gt;
&lt;script language="javascript" src="/dp.SyntaxHighlighter/Scripts/shCore.js"&gt;&lt;/script&gt;
&lt;script language="javascript" src="/dp.SyntaxHighlighter/Scripts/shBrushVb.js"&gt;&lt;/script&gt;
&lt;p&gt;&lt;span style="color:black;font-family:Verdana;font-size:10pt;"&gt;This week I needed a simple&amp;nbsp;text box control that could display text vertically, &lt;/span&gt;&lt;span style="color:black;font-family:Verdana;font-size:10pt;"&gt;something like this: &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left:27pt;"&gt;&lt;img src="http://vbcity.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/mike-mcintyre.metablogapi/1731.112510_5F00_2046_5F00_SimpleVerti1.png" alt="" /&gt;&lt;span style="font-family:Times New Roman;font-size:12pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:black;font-family:Verdana;font-size:10pt;"&gt;Here&amp;#39;s what I came up with:&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre name="1da985336664432c94fed15333490fb9" class="VB.NET"&gt;
Public Class VerticalTextBox 
Inherits System.Windows.Forms.Control 

Public Sub New() 
End Sub 

Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) 
Dim g As Graphics = e.Graphics 

Using format As New StringFormat(StringFormatFlags.DirectionVertical) 
Using brush As New SolidBrush(ForeColor) 
g.DrawString(Text, Font, brush, 0, 0, format) 
End Using 
End Using 
End Sub 
End Class
&lt;/pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:black;font-family:Verdana;font-size:10pt;"&gt;To use this control add the class declaration above to a Visual Studio 2008 or 2010 project and the compile the project. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color:black;font-family:Verdana;font-size:10pt;"&gt;The new control will show up in the Visual Studio toolbox (1) from which you can drag it to the form designer surface to add the control to a form (2). &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left:27pt;"&gt;&lt;img src="http://vbcity.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/mike-mcintyre.metablogapi/3276.112510_5F00_2046_5F00_SimpleVerti2.png" alt="" /&gt;&lt;span style="font-family:Times New Roman;font-size:12pt;"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;script language="javascript"&gt;
dp.SyntaxHighlighter.ClipboardSwf = '/dp.SyntaxHighlighter/Scripts/clipboard.swf'
dp.SyntaxHighlighter.HighlightAll('1da985336664432c94fed15333490fb9')
&lt;/script&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://vbcity.com/aggbug.aspx?PostID=698411" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/hpFHajA8pUg" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/hpFHajA8pUg/post.aspx</link>
      <author>Mike McIntyre - Mike McIntyre</author>
      <pubDate>Sat, 27 Nov 2010 20:46:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7654</feedburner:origLink></item>
    <item>
      <title>Project Crescent - Silverlight Reporting and Business Intelligence</title>
      <description>&lt;p&gt;&lt;small&gt;&lt;b&gt;Channel: Mike McIntyre&lt;/b&gt;&lt;/small&gt;&lt;/p&gt; &lt;p&gt;At Microsoft&amp;#39;s PASS Summit 2010 attendees were introduced to Project &amp;ldquo;Crescent&amp;rdquo;, a stunning new data visualization experience coming in the SQL &amp;ldquo;Denali&amp;rdquo;. &lt;/p&gt;
&lt;p&gt;Built on Silverlight, Crescent gives users new ways of exploring data&amp;nbsp;and discovering new insights, and presenting this information in new and exciting ways, letting the data tell a story about your business.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://vbcity.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/mike-mcintyre/7266.ProjectCrescent.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;Learn more and watch the video:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;a target="_blank" href="http://blogs.msdn.com/b/sqlrsteamblog/archive/2010/11/09/a-glimpse-at-project-crescent.aspx"&gt;A Glimpse at Project Crescent&lt;/a&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;a target="_blank" href="http://team.silverlight.net/announcement/project-crescent/"&gt;Project Crescent!!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://vbcity.com/aggbug.aspx?PostID=698423" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/vbfeeds/~4/dD36L1E0ekU" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/vbfeeds/~3/dD36L1E0ekU/post.aspx</link>
      <author>Mike McIntyre - Mike McIntyre</author>
      <pubDate>Sat, 27 Nov 2010 18:26:00 PST</pubDate>
    <feedburner:origLink>http://vbfeeds.com/post.aspx?id=7652</feedburner:origLink></item>
  </channel>
</rss>
