From b90654934e5a41a3bfd582f799d3e60c745e43e3 Mon Sep 17 00:00:00 2001 From: Lex Li Date: Sun, 12 Jan 2014 11:38:19 +0800 Subject: [PATCH] Fixed #161. --- WinFormsUI.Docking.sln | 10 +++++++++- WinFormsUI/Docking/VS2012LightDockPaneStrip.cs | 14 +++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/WinFormsUI.Docking.sln b/WinFormsUI.Docking.sln index dc66d9d..f19aac7 100644 --- a/WinFormsUI.Docking.sln +++ b/WinFormsUI.Docking.sln @@ -1,9 +1,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsUI", "WinFormsUI\WinFormsUI.csproj", "{C75532C4-765B-418E-B09B-46D36B2ABDB1}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DockSample", "DockSample\DockSample.csproj", "{40793A27-478B-4357-B4C3-FC8943131F3D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication1", "WindowsFormsApplication1\WindowsFormsApplication1.csproj", "{78043484-848E-49D9-A421-884541F3401A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -18,6 +22,10 @@ Global {40793A27-478B-4357-B4C3-FC8943131F3D}.Debug|Any CPU.Build.0 = Debug|Any CPU {40793A27-478B-4357-B4C3-FC8943131F3D}.Release|Any CPU.ActiveCfg = Release|Any CPU {40793A27-478B-4357-B4C3-FC8943131F3D}.Release|Any CPU.Build.0 = Release|Any CPU + {78043484-848E-49D9-A421-884541F3401A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78043484-848E-49D9-A421-884541F3401A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78043484-848E-49D9-A421-884541F3401A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78043484-848E-49D9-A421-884541F3401A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/WinFormsUI/Docking/VS2012LightDockPaneStrip.cs b/WinFormsUI/Docking/VS2012LightDockPaneStrip.cs index 6507742..5c638d8 100644 --- a/WinFormsUI/Docking/VS2012LightDockPaneStrip.cs +++ b/WinFormsUI/Docking/VS2012LightDockPaneStrip.cs @@ -1227,7 +1227,7 @@ namespace WeifenLuo.WinFormsUI.Docking protected override void OnMouseClick(MouseEventArgs e) { base.OnMouseClick(e); - if (e.Button != MouseButtons.Left) + if (e.Button != MouseButtons.Left || Appearance != DockPane.AppearanceStyle.Document) return; var indexHit = HitTest(); @@ -1241,16 +1241,20 @@ namespace WeifenLuo.WinFormsUI.Docking var tabRect = GetTabRectangle(index); var closeButtonRect = GetCloseButtonRect(tabRect); var mouseRect = new Rectangle(mousePos, new Size(1, 1)); - if (closeButtonRect.IntersectsWith(mouseRect)) DockPane.CloseActiveContent(); } private Rectangle GetCloseButtonRect(Rectangle rectTab) { - const int gap = 5; - var dimension = rectTab.Height - gap; - return new Rectangle(rectTab.X + rectTab.Width - dimension - gap / 2 - 1, rectTab.Y + gap / 2 + 1, dimension, dimension); + if (Appearance != Docking.DockPane.AppearanceStyle.Document) + { + return Rectangle.Empty; + } + + const int gap = 3; + const int imageSize = 15; + return new Rectangle(rectTab.X + rectTab.Width - imageSize - gap - 1, rectTab.Y + gap, imageSize, imageSize); } private void WindowList_Click(object sender, EventArgs e)