<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>dotUpdate() &#187; .Net</title>
	<atom:link href="http://dotupdate.wordpress.com/category/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://dotupdate.wordpress.com</link>
	<description>Useful information about C# and .Net</description>
	<lastBuildDate>Mon, 28 Jan 2008 13:18:34 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='dotupdate.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/7f71844728c1706e14f53bc26005a0d7?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>dotUpdate() &#187; .Net</title>
		<link>http://dotupdate.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://dotupdate.wordpress.com/osd.xml" title="dotUpdate()" />
		<item>
		<title>Find the color of a point in a LinearGradientBrush</title>
		<link>http://dotupdate.wordpress.com/2008/01/28/find-the-color-of-a-point-in-a-lineargradientbrush/</link>
		<comments>http://dotupdate.wordpress.com/2008/01/28/find-the-color-of-a-point-in-a-lineargradientbrush/#comments</comments>
		<pubDate>Mon, 28 Jan 2008 12:54:22 +0000</pubDate>
		<dc:creator>dotupdate</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://dotupdate.wordpress.com/2008/01/28/find-the-color-of-a-point-in-a-lineargradientbrush/</guid>
		<description><![CDATA[I became intrigued by the problem of finding the color at any point of a rectangle that has been filled with a LinearGradientBrush.&#160; There is are techniques for doing this by essentially sampling the pixel at a rendered point but I wanted to approach the problem algorithmically.
I developed the following method which receives a rectangle [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dotupdate.wordpress.com&blog=1510168&post=24&subd=dotupdate&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I became intrigued by the problem of finding the color at any point of a rectangle that has been filled with a LinearGradientBrush.&nbsp; There is are techniques for doing this by essentially sampling the pixel at a rendered point but I wanted to approach the problem algorithmically.</p>
<p>I developed the following method which receives a rectangle object that has been filled with a LinearGradientBrush and a point relative to the upper left corner of the rectangle and returns the calculated color at that point.&nbsp; There are no restrictions on the Start/Stop Points or the number of GradientStops.&nbsp; The ColorInterpolationMode can be either SRgbLinearInterpolation (default) or ScRgbLinearInterpolation.&nbsp; The GradientSpreadMethod is required to be the default (Pad).</p>
<p>There are two methods below:</p>
<p>Color GetColorAtPoint(Rectangle r, Point p) &#8211; finds the color at any point of a LinearGradientBrush filled rectangle.</p>
<p>private Double dist(Point px, Point po, Point pf) &#8211; helper method for GetColorAtPoint.</p>
<p>To use, copy both methods to your class and call GetColorAtPoint() with a rectangle and point.</p>
<div style="border-right:gray 1px solid;border-top:gray 1px solid;font-size:8pt;overflow:auto;border-left:gray 1px solid;width:97.5%;cursor:text;max-height:200px;line-height:12pt;border-bottom:gray 1px solid;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;margin:20px 0 10px;padding:4px;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;padding:0;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#008000;">//Calculates the color of a point in a rectangle that is filled</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#008000;">//with a LinearGradientBrush.</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#0000ff;">private</span> Color GetColorAtPoint(Rectangle theRec, Point thePoint)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">{</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    <span style="color:#008000;">//Get properties</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    LinearGradientBrush br = (LinearGradientBrush)theRec.Fill;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">double</span> y3 = thePoint.Y;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">double</span> x3 = thePoint.X;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">double</span> x1 = br.StartPoint.X * theRec.ActualWidth;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">double</span> y1 = br.StartPoint.Y * theRec.ActualHeight;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    Point p1 = <span style="color:#0000ff;">new</span> Point(x1, y1); <span style="color:#008000;">//Starting point</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">double</span> x2 = br.EndPoint.X * theRec.ActualWidth;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">double</span> y2 = br.EndPoint.Y * theRec.ActualHeight;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    Point p2 = <span style="color:#0000ff;">new</span> Point(x2, y2);  <span style="color:#008000;">//End point</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    <span style="color:#008000;">//Calculate intersecting points </span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    Point p4 = <span style="color:#0000ff;">new</span> Point(); <span style="color:#008000;">//with tangent</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">if</span> (y1 == y2) <span style="color:#008000;">//Horizontal case</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">        p4 = <span style="color:#0000ff;">new</span> Point(x3, y1);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">else</span> <span style="color:#0000ff;">if</span> (x1 == x2) <span style="color:#008000;">//Vertical case</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">        p4 = <span style="color:#0000ff;">new</span> Point(x1, y3);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">else</span> <span style="color:#008000;">//Diagnonal case</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">double</span> m = (y2 - y1) / (x2 - x1);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">double</span> m2 = -1 / m;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">double</span> b = y1 - m * x1;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">double</span> c = y3 - m2 * x3;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">double</span> x4 = (c - b) / (m - m2);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">double</span> y4 = m * x4 + b;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">        p4 = <span style="color:#0000ff;">new</span> Point(x4, y4);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#008000;">//Calculate distances relative to the vector start</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">double</span> d4 = dist(p4, p1, p2);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">double</span> d2 = dist(p2, p1, p2);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">double</span> x = d4 / d2;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#008000;">//Clip the input if before or after the max/min offset values</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">double</span> max = br.GradientStops.Max(n =&gt; n.Offset);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">if</span> (x &gt; max)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">        x = max;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">double</span> min = br.GradientStops.Min(n =&gt; n.Offset);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">if</span> (x &lt; min)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">        x = min;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#008000;">//Find gradient stops that surround the input value</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    GradientStop gs0 = br.GradientStops.Where(n =&gt; n.Offset &lt;= x).OrderBy(n =&gt; n.Offset).Last();</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    GradientStop gs1 = br.GradientStops.Where(n =&gt; n.Offset &gt;= x).OrderBy(n =&gt; n.Offset).First();</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">float</span> y = 0f;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">if</span> (gs0.Offset != gs1.Offset)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">        y = (<span style="color:#0000ff;">float</span>)((x - gs0.Offset) / (gs1.Offset - gs0.Offset));</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#008000;">//Interpolate color channels</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    Color cx = <span style="color:#0000ff;">new</span> Color();</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">if</span> (br.ColorInterpolationMode == ColorInterpolationMode.ScRgbLinearInterpolation)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">float</span> aVal = (gs1.Color.ScA - gs0.Color.ScA) * y + gs0.Color.ScA;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">float</span> rVal = (gs1.Color.ScR - gs0.Color.ScR) * y + gs0.Color.ScR;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">float</span> gVal = (gs1.Color.ScG - gs0.Color.ScG) * y + gs0.Color.ScG;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">float</span> bVal = (gs1.Color.ScB - gs0.Color.ScB) * y + gs0.Color.ScB;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">        cx = Color.FromScRgb(aVal, rVal, gVal, bVal);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">else</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">byte</span> aVal = (<span style="color:#0000ff;">byte</span>)((gs1.Color.A - gs0.Color.A) * y + gs0.Color.A);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">byte</span> rVal = (<span style="color:#0000ff;">byte</span>)((gs1.Color.R - gs0.Color.R) * y + gs0.Color.R);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">byte</span> gVal = (<span style="color:#0000ff;">byte</span>)((gs1.Color.G - gs0.Color.G) * y + gs0.Color.G);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">byte</span> bVal = (<span style="color:#0000ff;">byte</span>)((gs1.Color.B - gs0.Color.B) * y + gs0.Color.B);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">        cx = Color.FromArgb(aVal, rVal, gVal, bVal);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">return</span> cx;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">}</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#008000;">//Helper method for GetColorAtPoint</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#008000;">//Returns the signed magnitude of a point on a vector with origin po and pointing to pf</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#0000ff;">private</span> <span style="color:#0000ff;">double</span> dist(Point px, Point po, Point pf)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">{</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">double</span> d = Math.Sqrt((px.Y - po.Y) * (px.Y - po.Y) + (px.X - po.X) * (px.X - po.X));</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">if</span> (((px.Y &lt; po.Y) &amp;&amp; (pf.Y &gt; po.Y)) ||</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">        ((px.Y &gt; po.Y) &amp;&amp; (pf.Y &lt; po.Y)) ||</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">        ((px.Y == po.Y) &amp;&amp; (px.X &lt; po.X) &amp;&amp; (pf.X &gt; po.X)) ||</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">        ((px.Y == po.Y) &amp;&amp; (px.X &gt; po.X) &amp;&amp; (pf.X &lt; po.X)))</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">        d = -d;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">return</span> d;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;">}</pre>
</div>
</div>
<p>The method works by projecting the input point onto the vector that is described by the LinearGradientBrush Start/Stop points.&nbsp; There are special cases for horizontal and vertical lines.&nbsp; The width of the line is calculated as well as the relative distance of the projected point from the StartPoint (using the dist() method).&nbsp; The GradientStops are ordered and two stops are found that are the closest the projected point.&nbsp; The color channel values are interpolated based on the relative position of the projected point and these two stops.&nbsp; The values are assembled into a color and returned.</p>
<p>You can download a demo of this method <a href="http://home.comcast.net/~boddie/HelpWithColorPick.zip">here.</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotupdate.wordpress.com/24/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotupdate.wordpress.com/24/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotupdate.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotupdate.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotupdate.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotupdate.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotupdate.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotupdate.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotupdate.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotupdate.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotupdate.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotupdate.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dotupdate.wordpress.com&blog=1510168&post=24&subd=dotupdate&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dotupdate.wordpress.com/2008/01/28/find-the-color-of-a-point-in-a-lineargradientbrush/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/37b04d480ecd15e5890aa8cd26eb184a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dotupdate</media:title>
		</media:content>
	</item>
		<item>
		<title>How to make an icon</title>
		<link>http://dotupdate.wordpress.com/2007/08/26/how-to-make-an-icon/</link>
		<comments>http://dotupdate.wordpress.com/2007/08/26/how-to-make-an-icon/#comments</comments>
		<pubDate>Sun, 26 Aug 2007 11:43:53 +0000</pubDate>
		<dc:creator>dotupdate</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://dotupdate.wordpress.com/2007/08/26/how-to-make-an-icon/</guid>
		<description><![CDATA[Apparently, .Net does not provide a good set of classes to create icons programmatically.&#160; In helping someone on a forum, I ran across a free tool for image processing that does a great job.
The technique uses a free .dll called FreeImage. I gave it a try and with the help of a wrapper found in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dotupdate.wordpress.com&blog=1510168&post=9&subd=dotupdate&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Apparently, .Net does not provide a good set of classes to create icons programmatically.&nbsp; In helping someone on a forum, I ran across a free tool for image processing that does a great job.</p>
<p>The technique uses a free .dll called <a href="http://freeimage.sourceforge.net/index.html">FreeImage</a>. I gave it a try and with the help of a wrapper found in <a href="http://www.codeproject.com/csharp/FreeImageCSWrapper.asp?df=100">CodeProject</a> was able to convert a .bmp file to a .ico file.
<p>Here are the steps:
<p>1. Download the FreeImage .dll from <a href="http://freeimage.sourceforge.net/download.html">here</a>.
<p>2. Copy the .dll into the bin/Debug and/or bin/Release folder in your project
<p>3. Add an Enum and FreeImage Class to your project (shown in the example below).
<p>4. Use three calls to the functions in FreeImage: load the bitmap file, save in icon format, release the resource.
<p>The following example loads a .bmp into FreeImage and saves it back as a .ico file. It includes the required Enum and FreeImage Class. (Requires using System.Runtime.InteropServices; )</p>
<div style="border-right:gray 1px solid;border-top:gray 1px solid;font-size:8pt;overflow:auto;border-left:gray 1px solid;width:97.5%;cursor:text;max-height:200px;line-height:12pt;border-bottom:gray 1px solid;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;margin:20px 0 10px;padding:4px;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#0000ff;">class</span> Program
{
    <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> Main(<span style="color:#0000ff;">string</span>[] args)
    {
        <span style="color:#0000ff;">int</span> handle = FreeImage.FreeImage_Load(
            FIF.FIF_BMP,
            <span style="color:#006080;">@"C:\Documents and Settings\User\Desktop\myBmp.bmp"</span>,
            0);

        FreeImage.FreeImage_Save(
            FIF.FIF_ICO,
            handle,
            <span style="color:#006080;">@"C:\Documents and Settings\User\Desktop\new.ico"</span>,
            0);

        FreeImage.FreeImage_Unload(handle);         

    }
}

<span style="color:#0000ff;">public</span> <span style="color:#0000ff;">enum</span> FIF
{
    FIF_UNKNOWN = -1,
    FIF_BMP = 0,
    FIF_ICO = 1,
    FIF_JPEG = 2,
    FIF_JNG = 3,
    FIF_KOALA = 4,
    FIF_LBM = 5,
    FIF_MNG = 6,
    FIF_PBM = 7,
    FIF_PBMRAW = 8,
    FIF_PCD = 9,
    FIF_PCX = 10,
    FIF_PGM = 11,
    FIF_PGMRAW = 12,
    FIF_PNG = 13,
    FIF_PPM = 14,
    FIF_PPMRAW = 15,
    FIF_RAS = 16,
    FIF_TARGA = 17,
    FIF_TIFF = 18,
    FIF_WBMP = 19,
    FIF_PSD = 20,
    FIF_CUT = 21,
    FIF_IFF = FIF_LBM,
    FIF_XBM = 22,
    FIF_XPM = 23
}
<span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> FreeImage
{
     [DllImport(<span style="color:#006080;">"FreeImage.dll"</span>)]
     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">extern</span> <span style="color:#0000ff;">int</span> FreeImage_Load(FIF format,
                    <span style="color:#0000ff;">string</span> filename, <span style="color:#0000ff;">int</span> flags);

     [DllImport(<span style="color:#006080;">"FreeImage.dll"</span>)]
     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">extern</span> <span style="color:#0000ff;">void</span> FreeImage_Unload(<span style="color:#0000ff;">int</span> handle);

     [DllImport(<span style="color:#006080;">"FreeImage.dll"</span>)]
     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">extern</span> <span style="color:#0000ff;">bool</span> FreeImage_Save(FIF format,
        <span style="color:#0000ff;">int</span> handle, <span style="color:#0000ff;">string</span> filename, <span style="color:#0000ff;">int</span> flags);
}</pre>
</div>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotupdate.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotupdate.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotupdate.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotupdate.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotupdate.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotupdate.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotupdate.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotupdate.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotupdate.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotupdate.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotupdate.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotupdate.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dotupdate.wordpress.com&blog=1510168&post=9&subd=dotupdate&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dotupdate.wordpress.com/2007/08/26/how-to-make-an-icon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/37b04d480ecd15e5890aa8cd26eb184a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dotupdate</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual Studio 411</title>
		<link>http://dotupdate.wordpress.com/2007/08/16/visual-studio-411/</link>
		<comments>http://dotupdate.wordpress.com/2007/08/16/visual-studio-411/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 14:14:10 +0000</pubDate>
		<dc:creator>dotupdate</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://dotupdate.wordpress.com/2007/08/16/visual-studio-411/</guid>
		<description><![CDATA[Visual Studio has a powerful array of features that can greatly boost productivity&#8211;especially for new programmers who may not have a full grasp of the .Net framework.&#160; While the C# language itself&#160;is quite compact and comprehensible, the number of classes available in the .Net framework is almost mind boggling.&#160; How is a newcomer supposed to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dotupdate.wordpress.com&blog=1510168&post=8&subd=dotupdate&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Visual Studio has a powerful array of features that can greatly boost productivity&#8211;especially for new programmers who may not have a full grasp of the .Net framework.&nbsp; While the C# language itself&nbsp;is quite compact and comprehensible, the number of classes available in the .Net framework is almost mind boggling.&nbsp; How is a newcomer supposed to remember it all?</p>
<p>The good news is that with Visual Studio you don&#8217;t have to.&nbsp; You just need to know how to get the information (&#8216;411&#8242;) when you need it.&nbsp; Here are the most helpful features for me:</p>
<h4><font color="#333333">Intellesense</font></h4>
<p>There are three big productivity enhancements that I get out of Intellesense.&nbsp; First, I use it to help find out what is possible with an object.&nbsp; By typing a &#8216;.&#8217; after the object name in a statement, the Intellesense drop down shows all of the properties and methods that are available to me.&nbsp; Icons by the names of the members indicate the type (properties: a page with a hand, methods: a diamond, events: a lightning bolt).&nbsp; Second, selecting one of the members gives a brief synopsis which includes the type of value returned and the arguments that are expected.&nbsp; After selecting, if I type another delimiter (a space, a dot, a parenthesis), Intellesense will&nbsp; enter the code for me reducing the possibility of making a typographical mistake.&nbsp; For methods, entering the open parenthesis results in Intellesense showing the possible overloads (different argument possibilities).&nbsp; Intellesense is almost like having an expert programmer sitting over your shoulder advising you every step of the way.</p>
<h4><font color="#333333">Dynamic Help</font></h4>
<p>Dynamic help is a way of quickly getting to more information from the MSDN documentation file.&nbsp; Turn this feature on using menu Help &gt; Dynamic Help.&nbsp; Now, when you click on an item in the code view or the designer view, a list of links to the Help documentation is presented.&nbsp; Click on a link and most likely you will get exactly the information you are seeking.</p>
<h4><font color="#333333">MSDN Documentation</font></h4>
<p>Newcomers need to understand the format of the help documentation so as not to be overwhelmed by its scope.&nbsp; Every class typically has the following organization: an overview page, a members page listing all properties, methods and events, finally leading to pages for individual members.&nbsp; More often than not, the individual members page will offer an example that can be adapted or even copied directly into the application.</p>
<h4><font color="#333333">Index</font></h4>
<p>For me, the most useful way of getting to the information in the documentation (outside of dynamic help) is to use the Index: menu Help &gt; Index.&nbsp; Also available are &#8216;Search&#8217; and &#8216;Content&#8217; but &#8216;Index&#8217; works best for me.</p>
<h4><font color="#333333">How do I</font></h4>
<p>Help &gt; How do I can also lead to helpful articles in the documentation for doing the most common tasks like File IO or drawing.</p>
<h4><font color="#333333">Getting Help Online</font></h4>
<p>Outside of Visual Studio there is a wealth of information.&nbsp; If I have a question about a control or how to do something, chances are good that someone else has had the same problem and has already posted the solution.&nbsp; I usually fire up a search engine and put in a few keywords about the problem along with &#8216;msdn&#8217;.&nbsp; This biases the search to either the msdn documentation or one of the msdn forums.</p>
<p>For me, asking a question in an online forum is my option of last resort.&nbsp; Not that it is a bad thing to do but the time I spend using the other resources available is always a valuable learning experience in itself and can turn up nuggets that can be used in later projects.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotupdate.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotupdate.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotupdate.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotupdate.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotupdate.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotupdate.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotupdate.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotupdate.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotupdate.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotupdate.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotupdate.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotupdate.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dotupdate.wordpress.com&blog=1510168&post=8&subd=dotupdate&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dotupdate.wordpress.com/2007/08/16/visual-studio-411/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/37b04d480ecd15e5890aa8cd26eb184a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dotupdate</media:title>
		</media:content>
	</item>
	</channel>
</rss>