<?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/"
	>

<channel>
	<title>code.commongroove.com &#187; WinForms</title>
	<atom:link href="http://code.commongroove.com/category/winforms/feed/" rel="self" type="application/rss+xml" />
	<link>http://code.commongroove.com</link>
	<description>C#, T-SQL, and general IT mojo</description>
	<lastBuildDate>Thu, 26 Jan 2012 03:00:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Retrieve Image from Windows Clipboard via .Net C#</title>
		<link>http://code.commongroove.com/2009/11/02/retrieve-image-from-windows-clipboard-via-net-c/</link>
		<comments>http://code.commongroove.com/2009/11/02/retrieve-image-from-windows-clipboard-via-net-c/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 21:32:34 +0000</pubDate>
		<dc:creator>Greg</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[WinForms]]></category>

		<guid isPermaLink="false">http://code.commongroove.com/archive/2009/11/02/retrieve-image-from-windows-clipboard-via-.net-c.aspx</guid>
		<description><![CDATA[If you want to snag clipboard data from a different application into the context of your running .Net application, here&#8217;s how you can do it: private static Image _clipBoardImage = null; private static Image GetImageFromCopyPasteBuffer&#40;&#41; &#123; Thread t = new &#8230; <a href="http://code.commongroove.com/2009/11/02/retrieve-image-from-windows-clipboard-via-net-c/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you want to snag clipboard data from a different application into the context of your running .Net application, here&#8217;s how you can do it:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:550px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> Image _clipBoardImage <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span><br />
<br />
<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> Image GetImageFromCopyPasteBuffer<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
Thread t <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Thread<span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> ThreadStart<span style="color: #008000;">&#40;</span>GetClipboardBitmap<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
t<span style="color: #008000;">.</span><span style="color: #0000FF;">SetApartmentState</span><span style="color: #008000;">&#40;</span>ApartmentState<span style="color: #008000;">.</span><span style="color: #0000FF;">STA</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
t<span style="color: #008000;">.</span><span style="color: #0000FF;">Start</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
t<span style="color: #008000;">.</span><span style="color: #0000FF;">Join</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF; font-weight: bold;">return</span> _clipBoardImage<span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#125;</span><br />
<br />
<span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> GetClipboardBitmap<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
IDataObject data <span style="color: #008000;">=</span> Clipboard<span style="color: #008000;">.</span><span style="color: #0000FF;">GetDataObject</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>data <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">||</span> <span style="color: #008000;">!</span>data<span style="color: #008000;">.</span><span style="color: #0000FF;">GetDataPresent</span><span style="color: #008000;">&#40;</span>DataFormats<span style="color: #008000;">.</span><span style="color: #0000FF;">Bitmap</span>, <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><br />
<span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> ApplicationException<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;No clipboard image data was present.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
_clipBoardImage <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>Image<span style="color: #008000;">&#41;</span>data<span style="color: #008000;">.</span><span style="color: #0000FF;">GetData</span><span style="color: #008000;">&#40;</span>DataFormats<span style="color: #008000;">.</span><span style="color: #0000FF;">Bitmap</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p>Hope this helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://code.commongroove.com/2009/11/02/retrieve-image-from-windows-clipboard-via-net-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.Net WebServices: Enabling or Disabling POST, GET, and Documentation Requests</title>
		<link>http://code.commongroove.com/2008/09/10/asp-net-webservices-enabling-or-disabling-post-get-and-documentation-requests/</link>
		<comments>http://code.commongroove.com/2008/09/10/asp-net-webservices-enabling-or-disabling-post-get-and-documentation-requests/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 03:38:20 +0000</pubDate>
		<dc:creator>Greg</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[WinForms]]></category>

		<guid isPermaLink="false">http://code.commongroove.com/archive/2008/09/09/asp.net-webservices-enabling-or-disabling-post-get-and-documentation-requests.aspx</guid>
		<description><![CDATA[It is relatively easy to control access to the various HTTP request types (protocols) for your ASP.Net WebService. Add something like this to the system.web section of your web.config: &#60;webServices&#62; &#60;protocols&#62; &#60;add name=&#34;HttpSoap&#34;/&#62; &#60;add name=&#34;HttpGet&#34;/&#62; &#60;!-- Because this web service &#8230; <a href="http://code.commongroove.com/2008/09/10/asp-net-webservices-enabling-or-disabling-post-get-and-documentation-requests/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It is relatively easy to control access to the various HTTP request types (protocols) for your ASP.Net WebService.</p>
<p>Add something like this to the system.web section of your web.config:</p>
<p><code class="codecolorer html4strict default"><span class="html4strict"><span style="color: #009900;">&lt;webServices&gt;</span><br />
<span style="color: #009900;">&lt;protocols&gt;</span><br />
<span style="color: #009900;">&lt;add <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;HttpSoap&quot;</span><span style="color: #66cc66;">/</span>&gt;</span><br />
<span style="color: #009900;">&lt;add <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;HttpGet&quot;</span><span style="color: #66cc66;">/</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!-- Because this web service is all GET methods remotely --&gt;</span><br />
<span style="color: #009900;">&lt;add <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;HttpPostLocalhost&quot;</span><span style="color: #66cc66;">/</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!-- So you can test/POST locally --&gt;</span><br />
<span style="color: #009900;">&lt;remove <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Documentation&quot;</span><span style="color: #66cc66;">/</span>&gt;</span>  <span style="color: #808080; font-style: italic;">&lt;!-- So the outside world can't see your method documentation --&gt;</span><br />
<span style="color: #009900;">&lt;remove <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;HttpPost&quot;</span><span style="color: #66cc66;">/</span>&gt;</span> <span style="color: #808080; font-style: italic;">&lt;!-- Remove general POSTs from the outside world --&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>protocols&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>webServices&gt;</span></span></code></p>
<p>Of course you will want to tailor this to the needs of your own web service. <img src='http://www.commongroove.com/code/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>﻿</p>
]]></content:encoded>
			<wfw:commentRss>http://code.commongroove.com/2008/09/10/asp-net-webservices-enabling-or-disabling-post-get-and-documentation-requests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Program Window Restores Down to Just the Title Bar</title>
		<link>http://code.commongroove.com/2008/08/04/program-windows-restores-down-to-just-the-title-bar/</link>
		<comments>http://code.commongroove.com/2008/08/04/program-windows-restores-down-to-just-the-title-bar/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 05:04:50 +0000</pubDate>
		<dc:creator>Greg</dc:creator>
				<category><![CDATA[Microsoft Office]]></category>
		<category><![CDATA[WinForms]]></category>

		<guid isPermaLink="false">http://code.commongroove.com/archive/2008/08/03/program-windows-restores-down-to-just-the-title-bar.aspx</guid>
		<description><![CDATA[Yeah, this really has nothing to do with programming, but wow, was this annoying.  Some how, Outlook shrunk itself down to just the title bar and I couldn&#8217;t find a way to restore it to a useful size (it was &#8230; <a href="http://code.commongroove.com/2008/08/04/program-windows-restores-down-to-just-the-title-bar/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Yeah, this really has nothing to do with programming, but wow, was this annoying.  Some how, Outlook shrunk itself down to just the title bar and I couldn&#8217;t find a way to restore it to a useful size (it was either just the title bar or fully maximized).</p>
<p>Lo and behold, there is a handy-dandy way to resize your windows.</p>
<p>First, Restore the window.  Next, right-click on the title bar and choose &#8220;Size&#8221;.  This allows you to customize (and fix whatever borked it) the window size.</p>
<p>Always check your context menu is the moral of the story I guess&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://code.commongroove.com/2008/08/04/program-windows-restores-down-to-just-the-title-bar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WinForm Exception Catching</title>
		<link>http://code.commongroove.com/2008/07/28/winform-exception-catching/</link>
		<comments>http://code.commongroove.com/2008/07/28/winform-exception-catching/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 08:20:17 +0000</pubDate>
		<dc:creator>Greg</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[WinForms]]></category>

		<guid isPermaLink="false">http://code.commongroove.com/archive/2008/07/28/winform-exception-catching.aspx</guid>
		<description><![CDATA[Here&#8217;s a general way to catch most outside exceptions in your WinForm code.  Add this to your program wrapper: Application.ThreadException += new ThreadExceptionEventHandler&#40;Application_ThreadException&#41;; AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler&#40;CurrentDomain_UnhandledException&#41;; Of course, it is always better to handle specific cases with specific types &#8230; <a href="http://code.commongroove.com/2008/07/28/winform-exception-catching/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a general way to catch most outside exceptions in your WinForm code.  Add this to your program wrapper:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:550px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Application<span style="color: #008000;">.</span><span style="color: #0000FF;">ThreadException</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> ThreadExceptionEventHandler<span style="color: #008000;">&#40;</span>Application_ThreadException<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<br />
AppDomain<span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentDomain</span><span style="color: #008000;">.</span><span style="color: #0000FF;">UnhandledException</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> UnhandledExceptionEventHandler<span style="color: #008000;">&#40;</span>CurrentDomain_UnhandledException<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
<p>Of course, it is always better to handle specific cases with specific types of exceptions, but it is also nice to have a general handler for anything that escapes your exception handling.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.commongroove.com/2008/07/28/winform-exception-catching/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

