<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.atalasoft.com/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Jake Opines : WinForms</title><link>http://www.atalasoft.com/cs/blogs/jake/archive/tags/WinForms/default.aspx</link><description>Tags: WinForms</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Beauty is only Skin-Deep Part Deux: If it looks like a duck, it might be a WinForm</title><link>http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx</link><pubDate>Mon, 19 May 2008 11:57:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:13999</guid><dc:creator>jacobl</dc:creator><slash:comments>1</slash:comments><comments>http://www.atalasoft.com/cs/blogs/jake/comments/13999.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/jake/commentrss.aspx?PostID=13999</wfw:commentRss><description>&lt;p&gt;&lt;img src="http://www.atalasoft.com/cs/photos/jacobs_blog_photos/images/13994/original.aspx" align="right" height="280" hspace="10" width="200"&gt;If it looks like a duck, quacks like a duck, and waddles like a duck, then it's probably a duck. But if it just looks like one, it might be my next WinForms application. Ah, and yes it is. This blog will put a useless spin on creating non-standard shaped WinForm applications. There are real uses for this practice like adding rounded corners or creating great looking splash screens, but outside of showing you how to do it, I'm not sure if the sample app I'm going to create will sell very well...&lt;/p&gt;&lt;p&gt;&lt;b&gt;Let's Get Started&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Open your favorite photo in a photo editor and crop it out so that it takes on the shape of your favorite feathered friend. Making sure the background is transparent, save it as a PNG and add it as a resource to a new WinForms project in Visual Studio.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Feather Your Form&lt;/b&gt; &lt;br&gt;&lt;/p&gt;&lt;p&gt;Just like I discussed in my last blog,&amp;nbsp; &lt;span class="entrylistheader"&gt;&lt;/span&gt;&lt;a href="http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx" id="bp___v___r___postlist___EntryItems_ctl01_PostTitle"&gt;Beauty is only Skin-Deep: Skinning your WinForms Application&lt;/a&gt;, we need to set the FormBorderStyle to None. This will get rid of the top bar and close, minimize, and maximize buttons. After that's done, let's add a PictureBox that contains our manic mallard to the form. You will need to resize your form to fit it all in.&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.atalasoft.com/cs/photos/jacobs_blog_photos/images/13995/original.aspx" style="width:459px;height:285px;" align="middle"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Transparency Is Key&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.atalasoft.com/cs/photos/jacobs_blog_photos/images/13996/original.aspx" style="width:139px;height:148px;" align="left" hspace="10"&gt;The last step to proving that I'm truly quacked is to set the TransparencyKey of the Form. To do this scroll to the bottom of the properties pane and changing the selected drop down item to match that of the BackColor property. The trick here is to make sure that you want that color to always be transparent in your application. In the case of my duck, I'm pretty sure the web color, Thistle, will be a safe bet. So, I'm choosing that as the BackColor for my form as well as the TransparencyKey.&lt;/p&gt;&lt;p&gt;That's it! Run your app and you will see it in all its glory!&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;img src="http://www.atalasoft.com/cs/photos/jacobs_blog_photos/images/13997/original.aspx" align="middle"&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight:bold;"&gt;Finishing Touches&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Check out &lt;a href="http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx" target="_blank"&gt;my last blog&lt;/a&gt; to add a close button and dragability to this cute canard and you've got yourself one of the most useless apps ever made. But that isn't why we did this, is it? The ability to apply TransparencyKeys to your applications will allow you to create skinned interfaces that have rounded corners and very attractive splash screens to set your application ahead of the pack.&lt;/p&gt;&lt;p&gt;Be warned, though; a little goes a long way! Skinning your application has to enhance usability or it is simply a step backwards. One of the most taken-for-granted usability enhancement is familiarity. So, if you intend on altering your WinForms, be sure to ease up and keep things simple.&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight:bold;"&gt;The Code&lt;/span&gt;&lt;/p&gt;&lt;p&gt;There is no "code", per se, but I am attaching my project with it's modified properties and my beautifully cropped duck as a resource. Enjoy!&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.atalasoft.com/cs/files/folders/13998/download.aspx" target="_blank"&gt;Get the Source Here&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx&amp;amp;;subject=Beauty+is+only+Skin-Deep+Part+Deux%3a+If+it+looks+like+a+duck%2c+it+might+be+a+WinForm" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx&amp;amp;;title=Beauty+is+only+Skin-Deep+Part+Deux%3a+If+it+looks+like+a+duck%2c+it+might+be+a+WinForm" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx&amp;amp;title=Beauty+is+only+Skin-Deep+Part+Deux%3a+If+it+looks+like+a+duck%2c+it+might+be+a+WinForm" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx&amp;amp;;title=Beauty+is+only+Skin-Deep+Part+Deux%3a+If+it+looks+like+a+duck%2c+it+might+be+a+WinForm" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx&amp;amp;;title=Beauty+is+only+Skin-Deep+Part+Deux%3a+If+it+looks+like+a+duck%2c+it+might+be+a+WinForm&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=13999" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/jake/archive/tags/Turducken/default.aspx">Turducken</category><category domain="http://www.atalasoft.com/cs/blogs/jake/archive/tags/WinForms/default.aspx">WinForms</category><category domain="http://www.atalasoft.com/cs/blogs/jake/archive/tags/UI/default.aspx">UI</category></item><item><title>Beauty is only Skin-Deep: Skinning your WinForms Application</title><link>http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx</link><pubDate>Fri, 09 May 2008 15:00:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:13951</guid><dc:creator>jacobl</dc:creator><slash:comments>3</slash:comments><comments>http://www.atalasoft.com/cs/blogs/jake/comments/13951.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/jake/commentrss.aspx?PostID=13951</wfw:commentRss><description>&lt;p&gt;We all want our Windows applications to stand out, and I think most people would like to believe that there are a few distinct approaches to achieving this. You can either have an app that does great things, one that does things great, or one that does things while looking great. The ideal approach is to combine all three and make great applications that do things very well while looking amazing. The first impression is everything, right? So this post is all about how to skin your application. While I can't turn you into Monet, I can show you what a paint brush looks like.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Eat Your Cake Without Having to Wait for Your Oven to Preheat&lt;br&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;There are toolkits out there that allow you to skin your apps very easily like &lt;a href="http://www.dotnetskin.net/" target="_blank"&gt;DotNetSkin&lt;/a&gt; or &lt;a href="http://www.sunisoft.com/" target="_blank"&gt;Sunisoft's IrisSkin&lt;/a&gt;, but most of them cost money and all you might want to do is change a few things without overhauling everything that is Windows UI.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Replacing Your Lamp Because Your Light Bulb Burnt Out&lt;/b&gt;&lt;br&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;i&gt;Alek Trebec - "Answer: All the things that make windows behave like windows."&lt;br&gt;&lt;/i&gt; &lt;/p&gt;

&lt;p&gt;&lt;i&gt;Contestant - "What are 'things I took for granted'?"&amp;nbsp;&lt;/i&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p class="MsoPlainText"&gt;&lt;img src="http://www.atalasoft.com/cs/photos/jacobs_blog_photos/images/13960/original.aspx" align="left" height="298" hspace="10" width="301"&gt;Just a forewarning: you are opening somewhat of a can of
worms here; albeit a small one. When you skin an app, there will be many things
that you got for free before but will now have to do yourself. Window-close,
-minimize, and -maximize are gone but easy enough to correct.&lt;span&gt; &lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoPlainText"&gt;Window dragging requires a little bit of finesse and
window resizing requires a bit more. I'll explain all that with sample code
below, but first, let's talk about getting rid of that awful XP-blue menu-bar.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Removing the Menu-Bar&lt;/b&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://www.atalasoft.com/cs/photos/jacobs_blog_photos/images/13962/original.aspx" align="right" height="123" hspace="10" width="133"&gt;After you have your project set up and are looking at your form in design-time. Open the &lt;u&gt;Properties&lt;/u&gt; pane form the main form object. Here, you need to find the Appearance labeled "FormBorderStyle". Change it from "Sizable" to "None". You will notice that in the design, your top menu bar and the border of the window are now gone! Excellent, a clean slate.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Readding Basic Window Controls&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;You can add all or none of these, but I suggest (for the sake of your users) that you at least add a close button. Here's what you do. &lt;/p&gt;

&lt;p&gt;&lt;u&gt;Close&lt;/u&gt; &lt;br&gt;&lt;/p&gt;

&lt;p&gt;Create a button in the upper right hand corner of your form; the location is by convention, you can put it anywhere you'd like of course. Change the name of the button to closeButton and double-click it so that Visual Studio brings you to the code view and creates you a OnClick event handler. Add the following code to it:&lt;br&gt;&lt;/p&gt;

&lt;p&gt;
&lt;code&gt;private void closeButton_Click(object sender, EventArgs e)&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp; Application.Exit();&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Very simple.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Minimize&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Create another button on your form and change its name to minButton. Double click it to open code view to its OnClick event handler. Add the following code to that one:&lt;/p&gt;

&lt;p&gt;
&lt;code&gt;
private void minButton_Click(object sender, EventArgs e)
        {&lt;br&gt;&amp;nbsp;&amp;nbsp; WindowState = FormWindowState.Minimized;&lt;br&gt;}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Maximized / Normal&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;There are two ways to do a "Maximize" button because you either have to change the button after it is maximized to a "Normal" button or you have to make the button's label generic enough that the one button can be used for both tasks. To keep things simple, we will do the latter.&lt;/p&gt;

&lt;p&gt;Create a button and change its name to maxNormButton and double click it like the last two examples. Add the following code to your event handler:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
private void maxNormButton_Click(object sender, EventArgs e)
        {&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp; if (WindowState == FormWindowState.Maximized)&lt;br&gt;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WindowState = FormWindowState.Normal;&lt;br&gt;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp; else&lt;br&gt;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WindowState = FormWindowState.Maximized;&lt;br&gt;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
}&lt;/code&gt; &lt;br&gt;&lt;/p&gt;

&lt;p&gt;I will leave creating that generic-enough label up to you because I can't really think of anything right now. How about a ~ (tilde). That's never used enough.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Moving that Window Around&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://www.atalasoft.com/cs/photos/jacobs_blog_photos/images/13959/original.aspx" align="left" height="268" hspace="10" width="294"&gt;To move your window around, you will need to handle the mouse down event as well as the mouse move event. We'll have to do some simple math to determine the offset from where the mouse was clicked to where it is after it has moved. But before we can do anything with that, we need to add something to the form to grab on to.&lt;/p&gt;

&lt;p&gt;You can either add a PictureBox or a Panel to your form. If you're looking to put something other than a solid color in the area, you'll want to go with the PictureBox, otherwise just drop a simple Panel up there and change it's BackColor property to something other than Control-gray. I will be using the Panel in this example.&lt;/p&gt;

&lt;p&gt;Add a Panel to your form and stretch it the length of your form placing it along your top edge. You can even Dock it on the top if you'd like, but if you want to add rounded corners, you wont want to do that. Change the name of the panel windowbarPanel.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Right click on your form and choose View Code. We need to capture when the user mouses down on your menu bar. Add a MouseDown event handler to the constructor of your form.&lt;/p&gt;

&lt;p&gt;
&lt;code&gt;
windowbarPanel.MouseDown += new MouseEventHandler(CaptureMouseDown);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The function that will handle the event, &lt;code&gt;void CaptureMouseDown&lt;/code&gt;, needs to save the mouse's position relative to your form's upper left hand corner. And it should only do this if the left mouse button is pressed. Create a private member variable _OffsetPoint of type Point to store your mouse position in. In the end, it should look like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;void CaptureMouseDown(object sender, MouseEventArgs e)&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp; if (e.Button == MouseButtons.Left)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _OffsetPoint = new Point(e.X, e.Y);&lt;br&gt;}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next we need to handle when the mouse is moved. Add a MouseMove event handler to the constructor of your form.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;windowbarPanel.MouseMove += new MouseEventHandler(MoveWindow);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The function that will be handling this event, &lt;code&gt;void MoveWindow&lt;/code&gt;, needs to offset the mouse's new position against it's MouseDown one and set the location of the window to that point. Again, only if the left mouse button is being pressed. Here it is:&lt;br&gt;&lt;/p&gt;

&lt;p&gt;
&lt;code&gt;
void MoveWindow(object sender, MouseEventArgs e)&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp; if (e.Button == MouseButtons.Left)&lt;br&gt;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Point mousePos = Control.MousePosition;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mousePos.Offset(-_OffsetPoint.X, -_OffsetPoint.Y);
                &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Location = mousePos;&lt;br&gt;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}
&lt;/code&gt;
&lt;/p&gt;

&lt;p&gt;Save it and build it and you've got yourself a form that doesn't have traditional Windows form borders but behaves a lot like one! Now, if only we could resize this thing...&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Resizing It&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;In traditional WinForms, you can grab any edge of a window and resize it. That's more than I want to get into in this post, so I'll only go over resizing your form from the lower left hand corner of the screen.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;In design-view, create a Panel in the lower left making it the size of your desired click area. Mine is about the size of an eraser head. Name it resizePanel.&amp;nbsp;&lt;/p&gt;

&lt;p&gt;In code-view, you need to capture the position of the mouse relative to the screen with a mouse down event handler and save the current size of the window. You'll have to create new member variables for the window's width and height (they're of type int) but we can reuse the _OffsetPoint from before since you can't resize and move a window at the same time. In the constructor of the form, add the following: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;resizePanel.MouseDown += new MouseEventHandler(CaptureMousePosition);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The CaptureMousePosition method should look like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;int _Width;&lt;br&gt;int _Height;&lt;br&gt;&lt;br&gt;
void CaptureMousePosition(object sender, MouseEventArgs e)
        &lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp; if (e.Button == MouseButtons.Left)&lt;br&gt;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _Width = Width;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _Height = Height;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _OffsetPoint = new Point(Control.MousePosition.X, Control.MousePosition.Y);&lt;br&gt;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next, we need to set the width and height of the window every time the MouseMove event is fired. Add the following line to your form's constructor:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
resizePanel.MouseMove += new MouseEventHandler(ResizeWindow);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The ResizeWindow method needs to figure out how far the mouse has moved and apply that to the width and height of the form. It should end up looking like this:&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;
void ResizeWindow(object sender, MouseEventArgs e)&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp; if (e.Button == MouseButtons.Left)&lt;br&gt;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Point mousePos = new Point(Control.MousePosition.X, Control.MousePosition.Y);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mousePos.Offset(-_OffsetPoint.X, -_OffsetPoint.Y);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Width = _Width + mousePos.X;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Height = _Height + mousePos.Y;&lt;br&gt;&amp;nbsp;&amp;nbsp; }
       &lt;br&gt;}&lt;/code&gt;&lt;/p&gt;&lt;p&gt;That's about it. It could definitely use some work, but it's a great start.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Just to Recap&lt;/b&gt;&lt;/p&gt;&lt;p&gt;With the information above, you can now create applications that have custom border elements. We had to rewrite the most basic window functions, but that's OK. It wasn't &lt;i&gt;that &lt;/i&gt;painful. I hope to see better-looking WinForm applications from all of you. The only piece that's up to you is embedding beautiful Photoshopped graphics for all of your buttons and borders.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Update&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.atalasoft.com/cs/photos/jacobs_blog_photos/images/13961/original.aspx" align="right" height="94" hspace="10" width="123"&gt;I've added some pictures that go along with the process. Also, here are a few notes about anchoring your new elements correctly. If you don't correctly anchor, your resizing will not work correctly.&lt;/p&gt;&lt;p&gt;Your close, minimize, and maximize buttons should be anchored to the upper right. Your windowBarPanel should be anchored to the left-top-right so it stretches accordingly. Lastly, your resizePanel should be anchored to the bottom right so that it moves with your mouse as you resize.&lt;br&gt;&lt;/p&gt;&lt;p&gt;Here's a sample project that does everything we've talked about in this blog:&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.atalasoft.com/cs/files/folders/13964/download.aspx" target="_blank"&gt;SkinFormsBlog.zip&lt;/a&gt;&lt;br&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx&amp;amp;;subject=Beauty+is+only+Skin-Deep%3a+Skinning+your+WinForms+Application" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx&amp;amp;;title=Beauty+is+only+Skin-Deep%3a+Skinning+your+WinForms+Application" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx&amp;amp;title=Beauty+is+only+Skin-Deep%3a+Skinning+your+WinForms+Application" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx&amp;amp;;title=Beauty+is+only+Skin-Deep%3a+Skinning+your+WinForms+Application" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx&amp;amp;;title=Beauty+is+only+Skin-Deep%3a+Skinning+your+WinForms+Application&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=13951" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/jake/archive/tags/WinForms/default.aspx">WinForms</category><category domain="http://www.atalasoft.com/cs/blogs/jake/archive/tags/UI/default.aspx">UI</category></item></channel></rss>