RaUI/Source/ryControls/WeifenLuo.WinFormsUI/ThemeVS2013/VS2013SplitterControl.cs

47 lines
1.5 KiB
C#
Raw Permalink Normal View History

using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
namespace WeifenLuo.WinFormsUI.ThemeVS2013
{
internal class VS2013SplitterControl : DockPane.SplitterControlBase
{
private readonly SolidBrush _horizontalBrush;
private int SplitterSize { get; }
public VS2013SplitterControl(DockPane pane)
: base(pane)
{
_horizontalBrush = pane.DockPanel.Theme.PaintingService.GetBrush(pane.DockPanel.Theme.ColorPalette.MainWindowActive.Background);
SplitterSize = pane.DockPanel.Theme.Measures.SplitterSize;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Rectangle rect = ClientRectangle;
if (rect.Width <= 0 || rect.Height <= 0)
return;
switch (Alignment)
{
case DockAlignment.Right:
case DockAlignment.Left:
{
Debug.Assert(SplitterSize == rect.Width);
e.Graphics.FillRectangle(_horizontalBrush, rect);
}
break;
case DockAlignment.Bottom:
case DockAlignment.Top:
{
Debug.Assert(SplitterSize == rect.Height);
e.Graphics.FillRectangle(_horizontalBrush, rect);
}
break;
}
}
}
}