{"id":268926,"date":"2015-11-24T22:28:02","date_gmt":"2015-11-24T19:28:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=268926"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=268926","title":{"rendered":"\u0420\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 NC (Non-Client Area). \u041a\u043d\u043e\u043f\u043a\u0430 \u043d\u0430 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435"},"content":{"rendered":"<p>       <i><b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430:<\/b> \u041f\u043e\u0437\u0436\u0435 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0443 \u0441\u0442\u0430\u0442\u044c\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435.<\/i><\/p>\n<p>  <i>\u041a\u043e\u0434 \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0441 \u0421#.<\/i><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b7c\/993\/d38\/b7c993d383e94a1a9edbc92f2165bd43.jpg\"\/><\/p>\n<p>  <a href=\"http:\/\/www.codeproject.com\/script\/articles\/download.aspx?file=\/KB\/dialog\/nonclientareavista\/WindowsApplication2.zip&amp;rp=http:\/\/www.codeproject.com\/Articles\/44235\/Painting-Vista-s-Aero-NonClientArea-in-VB-NET\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0430\u0440\u0445\u0438\u0432\u0430<\/a>.<\/p>\n<h4>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u042d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043a\u043e\u0434 \u043d\u0430 <i>VB.NET<\/i>, \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441 <i>C#<\/i>, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435: <a href=\"http:\/\/www.codeproject.com\/KB\/dialog\/AeroNonClientAreaButtons.aspx\">\u0420\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 <i>Non-Client Area<\/i><\/a><a name=\"habracut\"><\/a><\/p>\n<h4>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430<\/h4>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434, \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 (<i><b>Dwm.vb<\/b><\/i> \u0438 <i><b>WinApi.vb<\/b><\/i>) \u0438\u0437 \u0430\u0440\u0445\u0438\u0432\u0430 \u0432\u044b\u0448\u0435. \u0417\u0430\u0442\u0435\u043c, \u0432 \u043e\u043a\u043d\u043e, \u0432 <i>NC<\/i> \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"vbscript\">Imports WindowsApplication1.Dwm Imports WindowsApplication1.WinApi Imports WindowsApplication1.NcRender Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Text Imports System.Windows.Forms Imports System.Runtime.InteropServices Imports System.Diagnostics Imports System.Drawing.Drawing2D  Public Class Form1  #Region &quot;Fields&quot;     Private dwmMargins As Dwm.MARGINS     Private _marginOk As Boolean     Private _aeroEnabled As Boolean #End Region #Region &quot;Ctor&quot;     Public Sub New()         SetStyle(ControlStyles.ResizeRedraw, True)          InitializeComponent()          DoubleBuffered = True          CheckGlassEnabled()     End Sub #End Region #Region &quot;Props&quot;     Public ReadOnly Property AeroEnabled() As Boolean         Get             Return _aeroEnabled         End Get     End Property #End Region #Region &quot;Methods&quot;     ''' &lt;summary&gt;     ''' Sets the value of AeroEnabled     ''' &lt;\/summary&gt;     Private Sub CheckGlassEnabled()         If Environment.OSVersion.Version.Major &gt;= 6 Then             Dim enabled As Integer = 0             Dim response As Integer = Dwm.dwmIsCompositionEnabled(enabled)              _aeroEnabled = enabled = 1         End If     End Sub     ''' &lt;summary&gt;     ''' Equivalent to the LoWord C Macro     ''' &lt;\/summary&gt;     ''' &lt;param name=&quot;dwValue&quot;&gt;&lt;\/param&gt;     ''' &lt;returns&gt;&lt;\/returns&gt;     Public Shared Function LoWord(ByVal dwValue As Integer) As Integer         Return dwValue And &HFFFF     End Function     ''' &lt;summary&gt;     ''' Equivalent to the HiWord C Macro     ''' &lt;\/summary&gt;     ''' &lt;param name=&quot;dwValue&quot;&gt;&lt;\/param&gt;     ''' &lt;returns&gt;&lt;\/returns&gt;     Public Shared Function HiWord(ByVal dwValue As Integer) As Integer         Return (dwValue &gt;&gt; 16) And &HFFFF     End Function #End Region      Private Sub Form1_Activated(ByVal sender As Object, _                 ByVal e As System.EventArgs) Handles Me.Activated          Dwm.DwmExtendFrameIntoClientArea(Me.Handle, dwmMargins)     End Sub      Private Sub Form1_Paint(ByVal sender As Object, _                             ByVal e As System.Windows.Forms.PaintEventArgs) _                             Handles Me.Paint         If _aeroEnabled Then             e.Graphics.Clear(Color.Transparent)         Else             e.Graphics.Clear(Color.FromArgb(&HC2, &HD9, &HF7))         End If          e.Graphics.FillRectangle(SystemBrushes.ButtonFace, _                                  Rectangle.FromLTRB(dwmMargins.cxLeftWidth - 0, _                                  dwmMargins.cyTopHeight - 0, _                                  Width - dwmMargins.cxRightWidth - 0, _                                  Height - dwmMargins.cyBottomHeight - 0))     End Sub      Protected Overloads Overrides Sub WndProc(ByRef m As Message)         Dim WM_NCCALCSIZE As Integer = &H83         Dim WM_NCHITTEST As Integer = &H84         Dim result As IntPtr          Dim dwmHandled As Integer = Dwm.DwmDefWindowProc(m.HWnd, m.Msg, _                                     m.WParam, m.LParam, result)          If dwmHandled = 1 Then             m.Result = result             Exit Sub         End If          If m.Msg = WM_NCCALCSIZE AndAlso CInt(m.WParam) = 1 Then             Dim nccsp As NCCALCSIZE_PARAMS = _               DirectCast(Marshal.PtrToStructure(m.LParam, _               GetType(NCCALCSIZE_PARAMS)), NCCALCSIZE_PARAMS)              ' Adjust (shrink) the client rectangle to accommodate the border:             nccsp.rect0.Top += 0             nccsp.rect0.Bottom += 0             nccsp.rect0.Left += 0             nccsp.rect0.Right += 0              If Not _marginOk Then                 'Set what client area would be for passing to DwmExtendIntoClientArea                 dwmMargins.cyTopHeight = nccsp.rect2.Top - nccsp.rect1.Top                 dwmMargins.cxLeftWidth = nccsp.rect2.Left - nccsp.rect1.Left                 dwmMargins.cyBottomHeight = nccsp.rect1.Bottom - nccsp.rect2.Bottom                 dwmMargins.cxRightWidth = nccsp.rect1.Right - nccsp.rect2.Right                 _marginOk = True             End If              Marshal.StructureToPtr(nccsp, m.LParam, False)              m.Result = IntPtr.Zero         ElseIf m.Msg = WM_NCHITTEST AndAlso CInt(m.Result) = 0 Then             m.Result = HitTestNCA(m.HWnd, m.WParam, m.LParam)         Else             MyBase.WndProc(m)         End If     End Sub      Private Function HitTestNCA(ByVal hwnd As IntPtr, ByVal wparam _                                       As IntPtr, ByVal lparam As IntPtr) As IntPtr         Dim HTNOWHERE As Integer = 0         Dim HTCLIENT As Integer = 1         Dim HTCAPTION As Integer = 2         Dim HTGROWBOX As Integer = 4         Dim HTSIZE As Integer = HTGROWBOX         Dim HTMINBUTTON As Integer = 8         Dim HTMAXBUTTON As Integer = 9         Dim HTLEFT As Integer = 10         Dim HTRIGHT As Integer = 11         Dim HTTOP As Integer = 12         Dim HTTOPLEFT As Integer = 13         Dim HTTOPRIGHT As Integer = 14         Dim HTBOTTOM As Integer = 15         Dim HTBOTTOMLEFT As Integer = 16         Dim HTBOTTOMRIGHT As Integer = 17         Dim HTREDUCE As Integer = HTMINBUTTON         Dim HTZOOM As Integer = HTMAXBUTTON         Dim HTSIZEFIRST As Integer = HTLEFT         Dim HTSIZELAST As Integer = HTBOTTOMRIGHT          Dim p As New Point(LoWord(CInt(lparam)), HiWord(CInt(lparam)))          Dim topleft As Rectangle = RectangleToScreen(New Rectangle(0, 0, _                                    dwmMargins.cxLeftWidth, dwmMargins.cxLeftWidth))          If topleft.Contains(p) Then             Return New IntPtr(HTTOPLEFT)         End If          Dim topright As Rectangle = _           RectangleToScreen(New Rectangle(Width - dwmMargins.cxRightWidth, 0, _           dwmMargins.cxRightWidth, dwmMargins.cxRightWidth))          If topright.Contains(p) Then             Return New IntPtr(HTTOPRIGHT)         End If          Dim botleft As Rectangle = _            RectangleToScreen(New Rectangle(0, Height - dwmMargins.cyBottomHeight, _            dwmMargins.cxLeftWidth, dwmMargins.cyBottomHeight))          If botleft.Contains(p) Then             Return New IntPtr(HTBOTTOMLEFT)         End If          Dim botright As Rectangle = _             RectangleToScreen(New Rectangle(Width - dwmMargins.cxRightWidth, _             Height - dwmMargins.cyBottomHeight, _             dwmMargins.cxRightWidth, dwmMargins.cyBottomHeight))          If botright.Contains(p) Then             Return New IntPtr(HTBOTTOMRIGHT)         End If          Dim top As Rectangle = _             RectangleToScreen(New Rectangle(0, 0, Width, dwmMargins.cxLeftWidth))          If top.Contains(p) Then             Return New IntPtr(HTTOP)         End If          Dim cap As Rectangle = _             RectangleToScreen(New Rectangle(0, dwmMargins.cxLeftWidth, _             Width, dwmMargins.cyTopHeight - dwmMargins.cxLeftWidth))          If cap.Contains(p) Then             Return New IntPtr(HTCAPTION)         End If          Dim left As Rectangle = _             RectangleToScreen(New Rectangle(0, 0, dwmMargins.cxLeftWidth, Height))          If left.Contains(p) Then             Return New IntPtr(HTLEFT)         End If          Dim right As Rectangle = _             RectangleToScreen(New Rectangle(Width - dwmMargins.cxRightWidth, _             0, dwmMargins.cxRightWidth, Height))          If right.Contains(p) Then             Return New IntPtr(HTRIGHT)         End If          Dim bottom As Rectangle = _             RectangleToScreen(New Rectangle(0, Height - dwmMargins.cyBottomHeight, _             Width, dwmMargins.cyBottomHeight))          If bottom.Contains(p) Then             Return New IntPtr(HTBOTTOM)         End If          Return New IntPtr(HTCLIENT)     End Function  End Class <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u0435 15 \u043f\u043a\u0441. \u0432\u0430\u0448\u0435\u0433\u043e \u043e\u043a\u043d\u0430 <i>Client Area<\/i>, \u0438 \u0432\u0441\u0451, \u0447\u0442\u043e \u0432\u044b \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0445 15-20 \u043f\u043a\u0441. \u0432\u0430\u0448\u0435\u0433\u043e \u043e\u043a\u043d\u0430 \u0431\u0443\u0434\u0435\u0442, \u044f\u043a\u043e\u0431\u044b, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 &quot;<i>Non-Client Area<\/i>&quot;, \u0445\u043e\u0442\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0432 <i>Client Area<\/i>.<\/p>\n<p>  <i>\u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0441\u044e\u0434\u0430:<\/i> <a href=\"http:\/\/www.codeproject.com\/Articles\/32623\/Vista-Aero-ToolStrip-on-Non-Client-Area\">AeroNonClientAreaButtons.aspx<\/a>.<\/p>\n<p>  <i>\u0410\u0432\u0442\u043e\u0440\u0441\u0442\u0432\u043e \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0437\u0430 <b>Jos\u00e9 Mendez<\/b>; \u044f \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043b \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 VB.NET.<\/i>       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/271603\/\"> http:\/\/habrahabr.ru\/post\/271603\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <i><b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u0430:<\/b> \u041f\u043e\u0437\u0436\u0435 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0443 \u0441\u0442\u0430\u0442\u044c\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435.<\/i><\/p>\n<p>  <i>\u041a\u043e\u0434 \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0441 \u0421#.<\/i><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b7c\/993\/d38\/b7c993d383e94a1a9edbc92f2165bd43.jpg\"\/><\/p>\n<p>  <a href=\"http:\/\/www.codeproject.com\/script\/articles\/download.aspx?file=\/KB\/dialog\/nonclientareavista\/WindowsApplication2.zip&amp;rp=http:\/\/www.codeproject.com\/Articles\/44235\/Painting-Vista-s-Aero-NonClientArea-in-VB-NET\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0430\u0440\u0445\u0438\u0432\u0430<\/a>.<\/p>\n<h4>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u042d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043a\u043e\u0434 \u043d\u0430 <i>VB.NET<\/i>, \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441 <i>C#<\/i>, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435: <a href=\"http:\/\/www.codeproject.com\/KB\/dialog\/AeroNonClientAreaButtons.aspx\">\u0420\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 <i>Non-Client Area<\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-268926","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/268926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=268926"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/268926\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=268926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=268926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=268926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}