diff --git a/DarkUI/DarkUI.csproj b/DarkUI/DarkUI.csproj
index aaa2a5e..93d3e2a 100644
--- a/DarkUI/DarkUI.csproj
+++ b/DarkUI/DarkUI.csproj
@@ -124,6 +124,9 @@
DarkMessageBox.cs
+
+ Form
+
True
True
diff --git a/DarkUI/Docking/Items/DarkDockSplitter.cs b/DarkUI/Docking/Items/DarkDockSplitter.cs
index f913fad..9156f40 100644
--- a/DarkUI/Docking/Items/DarkDockSplitter.cs
+++ b/DarkUI/Docking/Items/DarkDockSplitter.cs
@@ -9,6 +9,7 @@ namespace DarkUI
private Control _control;
private DarkSplitterType _splitterType;
+ private DarkTranslucentForm _overlayForm;
#endregion
@@ -26,6 +27,7 @@ namespace DarkUI
{
_control = control;
_splitterType = splitterType;
+ _overlayForm = new DarkTranslucentForm(Color.Black);
switch (_splitterType)
{
@@ -44,6 +46,41 @@ namespace DarkUI
#region Method Region
+ public void ShowOverlay()
+ {
+ _overlayForm.Show();
+ UpdateOverlay(new Point(0, 0));
+ }
+
+ public void HideOverlay()
+ {
+ _overlayForm.Hide();
+ }
+
+ public void UpdateOverlay(Point difference)
+ {
+ var bounds = _control.RectangleToScreen(Bounds);
+
+ switch (_splitterType)
+ {
+ case DarkSplitterType.Left:
+ bounds.Location = new Point(bounds.Location.X - difference.X, bounds.Location.Y);
+ break;
+ case DarkSplitterType.Right:
+ bounds.Location = new Point(bounds.Location.X - difference.X, bounds.Location.Y);
+ break;
+ case DarkSplitterType.Top:
+ bounds.Location = new Point(bounds.Location.X, bounds.Location.Y - difference.Y);
+ break;
+ case DarkSplitterType.Bottom:
+ bounds.Location = new Point(bounds.Location.X, bounds.Location.Y - difference.Y);
+ break;
+ }
+
+ _overlayForm.Location = bounds.Location;
+ _overlayForm.Size = bounds.Size;
+ }
+
public void Move(Point difference)
{
switch (_splitterType)
diff --git a/DarkUI/Forms/DarkTranslucentForm.cs b/DarkUI/Forms/DarkTranslucentForm.cs
new file mode 100644
index 0000000..af957da
--- /dev/null
+++ b/DarkUI/Forms/DarkTranslucentForm.cs
@@ -0,0 +1,30 @@
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace DarkUI
+{
+ internal class DarkTranslucentForm : Form
+ {
+ #region Property Region
+
+ protected override bool ShowWithoutActivation
+ {
+ get { return true; }
+ }
+
+ #endregion
+
+ #region Constructor Region
+
+ public DarkTranslucentForm(Color backColor, double opacity = 0.6)
+ {
+ FormBorderStyle = FormBorderStyle.None;
+ ShowInTaskbar = false;
+ AllowTransparency = true;
+ Opacity = opacity;
+ BackColor = backColor;
+ }
+
+ #endregion
+ }
+}
diff --git a/DarkUI/Win32/DarkDockResizeFilter.cs b/DarkUI/Win32/DarkDockResizeFilter.cs
index b324e3d..4e2a550 100644
--- a/DarkUI/Win32/DarkDockResizeFilter.cs
+++ b/DarkUI/Win32/DarkDockResizeFilter.cs
@@ -10,6 +10,7 @@ namespace DarkUI
private DarkDockPanel _dockPanel;
+ private Timer _dragTimer;
private bool _isDragging;
private Point _initialContact;
private DarkDockSplitter _activeSplitter;
@@ -21,6 +22,10 @@ namespace DarkUI
public DarkDockResizeFilter(DarkDockPanel dockPanel)
{
_dockPanel = dockPanel;
+
+ _dragTimer = new Timer();
+ _dragTimer.Interval = 1;
+ _dragTimer.Tick += DragTimer_Tick;
}
#endregion
@@ -100,22 +105,45 @@ namespace DarkUI
#endregion
+ #region Event Handler Region
+
+ private void DragTimer_Tick(object sender, EventArgs e)
+ {
+ if (_dockPanel.MouseButtonState != MouseButtons.Left)
+ _isDragging = false;
+
+ if (!_isDragging)
+ {
+ _activeSplitter.HideOverlay();
+ _dragTimer.Stop();
+ ResetCursor();
+ return;
+ }
+
+ var difference = new Point(_initialContact.X - Cursor.Position.X, _initialContact.Y - Cursor.Position.Y);
+ _activeSplitter.UpdateOverlay(difference);
+ }
+
+ #endregion
+
#region Method Region
private void StartDrag(DarkDockSplitter splitter)
{
- Console.WriteLine("Start drag");
-
_activeSplitter = splitter;
Cursor.Current = _activeSplitter.ResizeCursor;
_initialContact = Cursor.Position;
_isDragging = true;
+
+ _activeSplitter.ShowOverlay();
+ _dragTimer.Start();
}
private void StopDrag()
{
- Console.WriteLine("Stop drag");
+ _activeSplitter.HideOverlay();
+ _dragTimer.Stop();
var difference = new Point(_initialContact.X - Cursor.Position.X, _initialContact.Y - Cursor.Position.Y);
_activeSplitter.Move(difference);
diff --git a/DarkUI/Win32/Native.cs b/DarkUI/Win32/Native.cs
index 0b4b781..e6b62e4 100644
--- a/DarkUI/Win32/Native.cs
+++ b/DarkUI/Win32/Native.cs
@@ -4,12 +4,12 @@ using System.Runtime.InteropServices;
namespace DarkUI
{
- public sealed class Native
+ internal sealed class Native
{
[DllImport("user32.dll")]
- public static extern IntPtr WindowFromPoint(Point point);
+ internal static extern IntPtr WindowFromPoint(Point point);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
- public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam);
+ internal static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam);
}
}
diff --git a/DarkUI/Win32/WindowsMessages.cs b/DarkUI/Win32/WindowsMessages.cs
index 2fc798c..3d06e2c 100644
--- a/DarkUI/Win32/WindowsMessages.cs
+++ b/DarkUI/Win32/WindowsMessages.cs
@@ -7,7 +7,7 @@ namespace DarkUI
/// Defined in winuser.h from Windows SDK v6.1
/// Documentation pulled from MSDN.
///
- public enum WM : uint
+ internal enum WM : uint
{
///
/// The WM_NULL message performs no operation. An application sends the WM_NULL message if it wants to post a message that the recipient window will ignore.