{"id":340,"date":"2017-03-04T21:01:42","date_gmt":"2017-03-04T12:01:42","guid":{"rendered":"http:\/\/marius.main.jp\/software\/blog\/?p=340"},"modified":"2017-03-06T11:25:27","modified_gmt":"2017-03-06T02:25:27","slug":"formborderstyle-none%e3%81%ae%e3%83%95%e3%82%a9%e3%83%bc%e3%83%a0%e3%81%abaero%e3%81%ae%e5%bd%b1%e3%82%92%e4%bb%98%e3%81%91%e3%82%8b","status":"publish","type":"post","link":"https:\/\/todosoft.net\/blog\/?p=340","title":{"rendered":"FormBorderStyle.None\u306e\u30d5\u30a9\u30fc\u30e0\u306bAero\u306e\u5f71\u3092\u4ed8\u3051\u308b"},"content":{"rendered":"<p>FormBorderStyle.None\u306e\u30d5\u30a9\u30fc\u30e0\u306f\u3001\u67a0\u304c\u306a\u304f\u306a\u308b\u3068\u540c\u6642\u306b\u3001\u5468\u56f2\u306e\u5f71\u3082\u6d88\u3048\u3066\u3057\u307e\u3046\u3002<\/p>\n<p><a href=\"http:\/\/marius.main.jp\/software\/blog\/wp-content\/uploads\/2017\/03\/Form_1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-341\" src=\"http:\/\/marius.main.jp\/software\/blog\/wp-content\/uploads\/2017\/03\/Form_1-300x297.png\" alt=\"\" width=\"300\" height=\"297\" srcset=\"https:\/\/todosoft.net\/blog\/wp-content\/uploads\/2017\/03\/Form_1-300x297.png 300w, https:\/\/todosoft.net\/blog\/wp-content\/uploads\/2017\/03\/Form_1-150x150.png 150w, https:\/\/todosoft.net\/blog\/wp-content\/uploads\/2017\/03\/Form_1.png 320w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u4e0b\u8a18\u30b3\u30fc\u30c9\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u3001Aero\u306e\u5f71\u3092\u5fa9\u6d3b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n<pre class=\"lang:c# decode:true \">    public partial class Form1 : Form\r\n    {\r\n        #region Win32API\r\n\r\n        [StructLayout(LayoutKind.Sequential)]\r\n        private struct MARGINS\r\n        {\r\n            public int leftWidth;\r\n            public int rightWidth;\r\n            public int topHeight;\r\n            public int bottomHeight;\r\n        }\r\n\r\n        [DllImport(\"dwmapi.dll\")]\r\n        private static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS margins);\r\n\r\n        private enum DWMWINDOWATTRIBUTE : uint\r\n        {\r\n            NCRenderingEnabled = 1,\r\n            NCRenderingPolicy,\r\n            TransitionsForceDisabled,\r\n            AllowNCPaint,\r\n            CaptionButtonBounds,\r\n            NonClientRtlLayout,\r\n            ForceIconicRepresentation,\r\n            Flip3DPolicy,\r\n            ExtendedFrameBounds,\r\n            HasIconicBitmap,\r\n            DisallowPeek,\r\n            ExcludedFromPeek,\r\n            Cloak,\r\n            Cloaked,\r\n            FreezeRepresentation\r\n        }\r\n\r\n        [DllImport(\"dwmapi.dll\", PreserveSig = true)]\r\n        private static extern int DwmSetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE attr, ref int attrValue, int attrSize);\r\n\r\n        [DllImport(\"dwmapi.dll\")]\r\n        private static extern int DwmIsCompositionEnabled(out bool enabled);\r\n\r\n        const int WM_NCPAINT = 0x85;\r\n\r\n\r\n        #endregion\r\n\r\n\r\n        public Form1()\r\n        {\r\n            InitializeComponent();\r\n\r\n            this.FormBorderStyle = FormBorderStyle.None;\r\n        }\r\n\r\n        [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = \"FullTrust\")]\r\n        protected override void WndProc(ref Message m)\r\n        {\r\n            switch (m.Msg)\r\n            {\r\n                case WM_NCPAINT:\r\n\r\n                    \/\/ \u30c7\u30b6\u30a4\u30f3\u6642\u306f\u51e6\u7406\u3057\u306a\u3044\r\n                    if (!DesignMode)\r\n                    {\r\n                        \/\/ Vista\u4ee5\u964d\u306eOS\u306e\u307f\r\n                        if (Environment.OSVersion.Version.Major &gt;= 6)\r\n                        {\r\n                            \/\/ Aero\u304c\u4f7f\u7528\u53ef\u80fd\u304b\u78ba\u8a8d\r\n                            bool bolAeroEnabled = false;\r\n                            DwmIsCompositionEnabled(out bolAeroEnabled);\r\n\r\n                            if (bolAeroEnabled == true)\r\n                            {\r\n                                int intAttrValue = 2;\r\n                                int intAttrSize = sizeof(int);\r\n                                DwmSetWindowAttribute(this.Handle, DWMWINDOWATTRIBUTE.NCRenderingPolicy, ref intAttrValue, intAttrSize);\r\n\r\n                                MARGINS objMargins = new MARGINS()\r\n                                {\r\n                                    leftWidth = 1,\r\n                                    rightWidth = 1,\r\n                                    topHeight = 1,\r\n                                    bottomHeight = 1\r\n                                };\r\n\r\n                                DwmExtendFrameIntoClientArea(this.Handle, ref objMargins);\r\n                            }\r\n                        }\r\n                    }\r\n\r\n                    break;\r\n            }\r\n            base.WndProc(ref m);\r\n        }\r\n    }<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/marius.main.jp\/software\/blog\/wp-content\/uploads\/2017\/03\/Form_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-342\" src=\"http:\/\/marius.main.jp\/software\/blog\/wp-content\/uploads\/2017\/03\/Form_2-300x275.png\" alt=\"\" width=\"300\" height=\"275\" srcset=\"https:\/\/todosoft.net\/blog\/wp-content\/uploads\/2017\/03\/Form_2-300x275.png 300w, https:\/\/todosoft.net\/blog\/wp-content\/uploads\/2017\/03\/Form_2.png 342w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u4f59\u8ac7\uff1aWPF\u306e\u5834\u5408\u306f\u3001<a href=\"http:\/\/grabacr.net\/archives\/1105\" target=\"_blank\">GlowWindow<\/a>\u3092\u4f7f\u3046\u3068\u7dba\u9e97\u306b\u3067\u304d\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>FormBorderStyle.None\u306e\u30d5\u30a9\u30fc\u30e0\u306f\u3001\u67a0\u304c\u306a\u304f\u306a\u308b\u3068\u540c\u6642\u306b\u3001\u5468\u56f2\u306e\u5f71\u3082\u6d88\u3048\u3066\u3057\u307e\u3046\u3002 \u4e0b\u8a18\u30b3\u30fc\u30c9\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u3001Aero\u306e\u5f71\u3092\u5fa9\u6d3b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002 public partial class Form1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,15],"tags":[],"class_list":["post-340","post","type-post","status-publish","format-standard","hentry","category-c","category-15"],"_links":{"self":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=340"}],"version-history":[{"count":2,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/340\/revisions"}],"predecessor-version":[{"id":346,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/340\/revisions\/346"}],"wp:attachment":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}