Fixed splitter overlays not sizing correctly

This commit is contained in:
Robin 2015-09-20 11:57:27 +01:00
parent 8aa5d67d6e
commit a6b6c376ac
3 changed files with 17 additions and 13 deletions

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
@ -131,10 +132,10 @@ namespace DarkUI
{ {
group.SendToBack(); group.SendToBack();
if (_groups.IsLast(group)) if (_groups.IsFirst(group))
group.Dock = dockStyle;
else
group.Dock = DockStyle.Fill; group.Dock = DockStyle.Fill;
else
group.Dock = dockStyle;
} }
} }
} }
@ -200,7 +201,7 @@ namespace DarkUI
_parentForm.ResizeEnd += ParentForm_ResizeEnd; _parentForm.ResizeEnd += ParentForm_ResizeEnd;
} }
private void ParentForm_ResizeEnd(object sender, System.EventArgs e) private void ParentForm_ResizeEnd(object sender, EventArgs e)
{ {
if (_splitter != null) if (_splitter != null)
_splitter.UpdateBounds(); _splitter.UpdateBounds();

View File

@ -10,7 +10,11 @@ namespace DarkUI
private Control _parentControl; private Control _parentControl;
private Control _control; private Control _control;
private DarkSplitterType _splitterType; private DarkSplitterType _splitterType;
private int _minimum;
private int _maximum;
private DarkTranslucentForm _overlayForm; private DarkTranslucentForm _overlayForm;
#endregion #endregion
@ -30,7 +34,6 @@ namespace DarkUI
_parentControl = parentControl; _parentControl = parentControl;
_control = control; _control = control;
_splitterType = splitterType; _splitterType = splitterType;
_overlayForm = new DarkTranslucentForm(Color.Black);
switch (_splitterType) switch (_splitterType)
{ {
@ -51,15 +54,15 @@ namespace DarkUI
public void ShowOverlay() public void ShowOverlay()
{ {
UpdateOverlay(new Point(0, 0)); _overlayForm = new DarkTranslucentForm(Color.Black);
_overlayForm.Visible = true;
_overlayForm.Show(); UpdateOverlay(new Point(0, 0));
_overlayForm.BringToFront();
} }
public void HideOverlay() public void HideOverlay()
{ {
_overlayForm.Hide(); _overlayForm.Visible = false;
} }
public void UpdateOverlay(Point difference) public void UpdateOverlay(Point difference)
@ -82,8 +85,7 @@ namespace DarkUI
break; break;
} }
_overlayForm.Location = bounds.Location; _overlayForm.Bounds = bounds;
_overlayForm.Size = bounds.Size;
} }
public void Move(Point difference) public void Move(Point difference)

View File

@ -18,8 +18,9 @@ namespace DarkUI
public DarkTranslucentForm(Color backColor, double opacity = 0.6) public DarkTranslucentForm(Color backColor, double opacity = 0.6)
{ {
StartPosition = FormStartPosition.Manual;
FormBorderStyle = FormBorderStyle.None; FormBorderStyle = FormBorderStyle.None;
Size = new Size(0, 0); Size = new Size(1, 1);
ShowInTaskbar = false; ShowInTaskbar = false;
AllowTransparency = true; AllowTransparency = true;
Opacity = opacity; Opacity = opacity;