mirror of
https://github.com/colhountech/DarkUI.Net5.git
synced 2025-07-23 12:11:32 +03:00
DockPanel now tracks active content
This commit is contained in:
parent
46ac401542
commit
c39af6c190
@ -1,4 +1,5 @@
|
||||
using DarkUI.Config;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
@ -59,10 +60,6 @@ namespace DarkUI.Docking
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public DarkDockGroup DockGroup { get; internal set; }
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsActive { get; internal set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor Region
|
||||
@ -81,5 +78,19 @@ namespace DarkUI.Docking
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event Handler Region
|
||||
|
||||
protected override void OnEnter(EventArgs e)
|
||||
{
|
||||
base.OnEnter(e);
|
||||
|
||||
if (DockPanel == null)
|
||||
return;
|
||||
|
||||
DockPanel.ActiveContent = this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,35 @@ namespace DarkUI.Docking
|
||||
private List<DarkDockContent> _contents;
|
||||
private Dictionary<DarkDockArea, DarkDockRegion> _regions;
|
||||
|
||||
private DarkDockContent _activeContent;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Property Region
|
||||
|
||||
public DarkDockContent ActiveContent
|
||||
{
|
||||
get { return _activeContent; }
|
||||
internal set
|
||||
{
|
||||
_activeContent = value;
|
||||
|
||||
ActiveGroup = _activeContent.DockGroup;
|
||||
ActiveRegion = ActiveGroup.DockRegion;
|
||||
|
||||
foreach (var content in _contents)
|
||||
content.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public DarkDockRegion ActiveRegion { get; internal set; }
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public DarkDockGroup ActiveGroup { get; internal set; }
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public IMessageFilter MessageFilter { get; private set; }
|
||||
|
@ -33,6 +33,18 @@ namespace DarkUI.Docking
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method Region
|
||||
|
||||
private bool IsActive()
|
||||
{
|
||||
if (DockPanel == null)
|
||||
return false;
|
||||
|
||||
return DockPanel.ActiveContent == this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Paint Region
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
@ -45,10 +57,12 @@ namespace DarkUI.Docking
|
||||
g.FillRectangle(b, ClientRectangle);
|
||||
}
|
||||
|
||||
var isActive = IsActive();
|
||||
|
||||
// Draw header
|
||||
var bgColor = IsActive ? Colors.BlueBackground : Colors.HeaderBackground;
|
||||
var darkColor = IsActive ? Colors.DarkBlueBorder : Colors.DarkBorder;
|
||||
var lightColor = IsActive ? Colors.LightBlueBorder : Colors.LightBorder;
|
||||
var bgColor = isActive ? Colors.BlueBackground : Colors.HeaderBackground;
|
||||
var darkColor = isActive ? Colors.DarkBlueBorder : Colors.DarkBorder;
|
||||
var lightColor = isActive ? Colors.LightBlueBorder : Colors.LightBorder;
|
||||
|
||||
using (var b = new SolidBrush(bgColor))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user