{"id":53,"date":"2011-04-13T10:45:02","date_gmt":"2011-04-13T00:45:02","guid":{"rendered":"http:\/\/www.reenadu.com\/?p=53"},"modified":"2011-04-13T10:45:02","modified_gmt":"2011-04-13T00:45:02","slug":"decorate-your-net-winform-application-in-a-peculiar-way","status":"publish","type":"post","link":"https:\/\/nickdu.com\/?p=53","title":{"rendered":"Decorate your .Net WinForm application in a peculiar way"},"content":{"rendered":"<p>This article actually was written in last Christmas, now I just re-post in my new home.<\/p>\n<p>Every programmer wants his application GUI to stand out, and so do I. A new idea came into my mind. I would like to add a Christmas hat on the top left corner of my WinForm application. This is not only simple but also not adding too much work load.<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"http:\/\/www.nickdu.com\/wp-content\/uploads\/2011\/04\/hat.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-54\" title=\"hat\" src=\"http:\/\/www.nickdu.com\/wp-content\/uploads\/2011\/04\/hat.jpg\" alt=\"\" width=\"150\" height=\"119\" \/><\/a><\/p>\n<p><a href=\"http:\/\/en.wikipedia.org\/wiki\/Skin_%28computing%29\" target=\"_blank\">.Net application skin<\/a> could be the first solution for most programmer. But it seems not worth it, because a huge skin library has to be installed just for this simple function. Furthermore, commercial skin library is not free at all.<\/p>\n<p>I have to go back google again. Someone mention that it can <a href=\"http:\/\/www.google.com\/search?q=override+WndProc+draw+titlebar\" target=\"_blank\">override WndProc<\/a> and in WM_NCPAINT, you have to draw your own title bar, and write function for each button. It seems a lot of work to do.Finally, I invent this peculiar way.<\/p>\n<p style=\"padding-left: 30px;\">1.\tCreate a transparent Form,<br \/>\n2.\tPut only a hat inside<br \/>\n3.\tLet it stay on the top left corner<\/p>\n<pre lang=\"csharp\">private void Form1_LocationChanged(object sender, System.EventArgs e)\n{\n    hat.Location = new Point(this.Location.X-30,this.Location.Y-10);\n}\n\nprivate void Form1_Activated(object sender, System.EventArgs e)\n{\n    if(!hat.TopMost)\n    {\n        hat.TopMost = true;\n        hat.BringToFront();\n    }\n}\n\nprivate void Form1_Deactivate(object sender, System.EventArgs e)\n{\n    if(hat.TopMost)\n        hat.TopMost = false;\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This article actually was written in last Christmas, now I just re-post in my new home. Every programmer wants his application GUI to stand out, and so do I. A new idea came into my mind. I would like to add a Christmas hat on the top left corner of my WinForm application. This is &hellip; <a href=\"https:\/\/nickdu.com\/?p=53\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Decorate your .Net WinForm application in a peculiar way&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,2],"tags":[],"class_list":["post-53","post","type-post","status-publish","format-standard","hentry","category-net","category-it"],"_links":{"self":[{"href":"https:\/\/nickdu.com\/index.php?rest_route=\/wp\/v2\/posts\/53","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nickdu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nickdu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nickdu.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nickdu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=53"}],"version-history":[{"count":0,"href":"https:\/\/nickdu.com\/index.php?rest_route=\/wp\/v2\/posts\/53\/revisions"}],"wp:attachment":[{"href":"https:\/\/nickdu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=53"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nickdu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=53"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nickdu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=53"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}