mirror of
https://github.com/colhountech/DarkUI.Net5.git
synced 2025-07-25 12:41:34 +03:00
Fixed splitter highlights
This commit is contained in:
parent
3c71944591
commit
99b405be39
@ -193,7 +193,7 @@ namespace DarkUI
|
|||||||
base.OnLayout(e);
|
base.OnLayout(e);
|
||||||
|
|
||||||
if (_splitter != null)
|
if (_splitter != null)
|
||||||
_splitter.UpdateBounds();
|
_splitter.UpdateBounds(DockPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -48,8 +48,10 @@ namespace DarkUI
|
|||||||
|
|
||||||
public void ShowOverlay()
|
public void ShowOverlay()
|
||||||
{
|
{
|
||||||
_overlayForm.Show();
|
|
||||||
UpdateOverlay(new Point(0, 0));
|
UpdateOverlay(new Point(0, 0));
|
||||||
|
|
||||||
|
_overlayForm.Show();
|
||||||
|
_overlayForm.BringToFront();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HideOverlay()
|
public void HideOverlay()
|
||||||
@ -59,7 +61,7 @@ namespace DarkUI
|
|||||||
|
|
||||||
public void UpdateOverlay(Point difference)
|
public void UpdateOverlay(Point difference)
|
||||||
{
|
{
|
||||||
var bounds = _control.RectangleToScreen(Bounds);
|
var bounds = new Rectangle(Bounds.Location, Bounds.Size);
|
||||||
|
|
||||||
switch (_splitterType)
|
switch (_splitterType)
|
||||||
{
|
{
|
||||||
@ -89,10 +91,10 @@ namespace DarkUI
|
|||||||
_control.Width += difference.X;
|
_control.Width += difference.X;
|
||||||
break;
|
break;
|
||||||
case DarkSplitterType.Right:
|
case DarkSplitterType.Right:
|
||||||
_control.Width -= difference.X;
|
_control.Width += difference.X;
|
||||||
break;
|
break;
|
||||||
case DarkSplitterType.Top:
|
case DarkSplitterType.Top:
|
||||||
_control.Height += difference.Y;
|
_control.Height -= difference.Y;
|
||||||
break;
|
break;
|
||||||
case DarkSplitterType.Bottom:
|
case DarkSplitterType.Bottom:
|
||||||
_control.Height -= difference.Y;
|
_control.Height -= difference.Y;
|
||||||
@ -100,21 +102,26 @@ namespace DarkUI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateBounds()
|
public void UpdateBounds(Control rootControl)
|
||||||
{
|
{
|
||||||
|
if (rootControl == null)
|
||||||
|
rootControl = _control;
|
||||||
|
|
||||||
|
var bounds = rootControl.RectangleToScreen(_control.Bounds);
|
||||||
|
|
||||||
switch (_splitterType)
|
switch (_splitterType)
|
||||||
{
|
{
|
||||||
case DarkSplitterType.Left:
|
case DarkSplitterType.Left:
|
||||||
Bounds = new Rectangle(_control.Left - 2, _control.Top, 5, _control.Height);
|
Bounds = new Rectangle(bounds.Left - 2, bounds.Top, 5, bounds.Height);
|
||||||
break;
|
break;
|
||||||
case DarkSplitterType.Right:
|
case DarkSplitterType.Right:
|
||||||
Bounds = new Rectangle(_control.Right - 3, _control.Top, 5, _control.Height);
|
Bounds = new Rectangle(bounds.Right - 3, bounds.Top, 5, bounds.Height);
|
||||||
break;
|
break;
|
||||||
case DarkSplitterType.Top:
|
case DarkSplitterType.Top:
|
||||||
Bounds = new Rectangle(_control.Left, _control.Top - 2, _control.Width, 5);
|
Bounds = new Rectangle(bounds.Left, bounds.Top - 2, bounds.Width, 5);
|
||||||
break;
|
break;
|
||||||
case DarkSplitterType.Bottom:
|
case DarkSplitterType.Bottom:
|
||||||
Bounds = new Rectangle(_control.Left, _control.Bottom - 5, _control.Width, 5);
|
Bounds = new Rectangle(bounds.Left, bounds.Bottom - 5, bounds.Width, 5);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,13 +69,11 @@ namespace DarkUI
|
|||||||
// Start drag.
|
// Start drag.
|
||||||
if (m.Msg == (int)WM.LBUTTONDOWN)
|
if (m.Msg == (int)WM.LBUTTONDOWN)
|
||||||
{
|
{
|
||||||
foreach (var splitter in _dockPanel.Splitters)
|
var hotSplitter = HotSplitter();
|
||||||
|
if (hotSplitter != null)
|
||||||
{
|
{
|
||||||
if (splitter.Bounds.Contains(_dockPanel.PointToClient(Cursor.Position)))
|
StartDrag(hotSplitter);
|
||||||
{
|
return true;
|
||||||
StartDrag(splitter);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,11 +88,8 @@ namespace DarkUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Stop events passing through if we're hovering over a splitter
|
// Stop events passing through if we're hovering over a splitter
|
||||||
foreach (var splitter in _dockPanel.Splitters)
|
if (HotSplitter() != null)
|
||||||
{
|
return true;
|
||||||
if (splitter.Bounds.Contains(_dockPanel.PointToClient(Cursor.Position)))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop all events from going through if we're dragging a splitter.
|
// Stop all events from going through if we're dragging a splitter.
|
||||||
if (_isDragging)
|
if (_isDragging)
|
||||||
@ -142,8 +137,8 @@ namespace DarkUI
|
|||||||
|
|
||||||
private void StopDrag()
|
private void StopDrag()
|
||||||
{
|
{
|
||||||
_activeSplitter.HideOverlay();
|
|
||||||
_dragTimer.Stop();
|
_dragTimer.Stop();
|
||||||
|
_activeSplitter.HideOverlay();
|
||||||
|
|
||||||
var difference = new Point(_initialContact.X - Cursor.Position.X, _initialContact.Y - Cursor.Position.Y);
|
var difference = new Point(_initialContact.X - Cursor.Position.X, _initialContact.Y - Cursor.Position.Y);
|
||||||
_activeSplitter.Move(difference);
|
_activeSplitter.Move(difference);
|
||||||
@ -151,19 +146,25 @@ namespace DarkUI
|
|||||||
_isDragging = false;
|
_isDragging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DarkDockSplitter HotSplitter()
|
||||||
|
{
|
||||||
|
foreach (var splitter in _dockPanel.Splitters)
|
||||||
|
{
|
||||||
|
if (splitter.Bounds.Contains(Cursor.Position))
|
||||||
|
return splitter;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void CheckCursor()
|
private void CheckCursor()
|
||||||
{
|
{
|
||||||
if (_isDragging)
|
if (_isDragging)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var splitter in _dockPanel.Splitters)
|
var hotSplitter = HotSplitter();
|
||||||
{
|
if (hotSplitter != null)
|
||||||
if (splitter.Bounds.Contains(_dockPanel.PointToClient(Cursor.Position)))
|
Cursor.Current = hotSplitter.ResizeCursor;
|
||||||
{
|
|
||||||
Cursor.Current = splitter.ResizeCursor;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ResetCursor()
|
private void ResetCursor()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user