------ #### RaUIV4 V4.0.2311.0701 - *.[全新]整合了MyDb、ryControls、MyDb_MySQL等dll文件到RaUI一个项目。 - *.[新增]新增ApkOp类,可以轻松获取APK信息。 - *.[新增]新增JsonExt扩展类,让Json操作更简单。 - *.[新增]新增WebP类,可以支持webp格式的图片。 - *.[改进]ryQuickSQL中的AddField方法改为自动替换已存在的同名值。 - *.[修复]ryQuickSQL中的AddFieldCalc方法无法正常计算的BUG。
145 lines
4.7 KiB
C#
145 lines
4.7 KiB
C#
using System;
|
|
using System.Diagnostics;
|
|
using System.Drawing;
|
|
using System.Drawing.Drawing2D;
|
|
using System.Windows.Forms;
|
|
using WeifenLuo.WinFormsUI.Docking;
|
|
|
|
namespace WeifenLuo.WinFormsUI.ThemeVS2012
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class VS2012WindowSplitterControl : SplitterBase
|
|
{
|
|
private readonly SolidBrush _horizontalBrush;
|
|
private readonly SolidBrush _backgroundBrush;
|
|
private PathGradientBrush _foregroundBrush;
|
|
private readonly Color[] _verticalSurroundColors;
|
|
private readonly ISplitterHost _host;
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="host"></param>
|
|
public VS2012WindowSplitterControl(ISplitterHost host)
|
|
{
|
|
_host = host;
|
|
_horizontalBrush = host.DockPanel.Theme.PaintingService.GetBrush(host.DockPanel.Theme.ColorPalette.TabSelectedInactive.Background);
|
|
_backgroundBrush = host.DockPanel.Theme.PaintingService.GetBrush(host.DockPanel.Theme.ColorPalette.MainWindowActive.Background);
|
|
_verticalSurroundColors = new[]
|
|
{
|
|
host.DockPanel.Theme.ColorPalette.MainWindowActive.Background
|
|
};
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="e"></param>
|
|
protected override void OnSizeChanged(EventArgs e)
|
|
{
|
|
base.OnSizeChanged(e);
|
|
Rectangle rect = ClientRectangle;
|
|
if (rect.Width <= 0 || rect.Height <= 0)
|
|
return;
|
|
|
|
if (Dock != DockStyle.Left && Dock != DockStyle.Right)
|
|
return;
|
|
|
|
_foregroundBrush?.Dispose();
|
|
using (var path = new GraphicsPath())
|
|
{
|
|
path.AddRectangle(rect);
|
|
_foregroundBrush = new PathGradientBrush(path)
|
|
{
|
|
CenterColor = _horizontalBrush.Color,
|
|
SurroundColors = _verticalSurroundColors
|
|
};
|
|
}
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="disposing"></param>
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (!IsDisposed && disposing)
|
|
{
|
|
_foregroundBrush?.Dispose();
|
|
}
|
|
|
|
base.Dispose(disposing);
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
protected override int SplitterSize
|
|
{
|
|
get { return _host.IsDockWindow ? _host.DockPanel.Theme.Measures.SplitterSize : _host.DockPanel.Theme.Measures.AutoHideSplitterSize; }
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
protected override void StartDrag()
|
|
{
|
|
_host.DockPanel.BeginDrag(_host, _host.DragControl.RectangleToScreen(Bounds));
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="e"></param>
|
|
protected override void OnPaint(PaintEventArgs e)
|
|
{
|
|
base.OnPaint(e);
|
|
|
|
Rectangle rect = ClientRectangle;
|
|
|
|
if (rect.Width <= 0 || rect.Height <= 0)
|
|
return;
|
|
|
|
if (_host.IsDockWindow)
|
|
{
|
|
switch (Dock)
|
|
{
|
|
case DockStyle.Right:
|
|
case DockStyle.Left:
|
|
{
|
|
Debug.Assert(SplitterSize == rect.Width);
|
|
e.Graphics.FillRectangle(_backgroundBrush, rect);
|
|
e.Graphics.FillRectangle(_foregroundBrush, rect.X + SplitterSize / 2 - 1, rect.Y,
|
|
SplitterSize / 3, rect.Height);
|
|
}
|
|
break;
|
|
case DockStyle.Bottom:
|
|
case DockStyle.Top:
|
|
{
|
|
Debug.Assert(SplitterSize == rect.Height);
|
|
e.Graphics.FillRectangle(_horizontalBrush, rect);
|
|
}
|
|
break;
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
switch (_host.DockState)
|
|
{
|
|
case DockState.DockRightAutoHide:
|
|
case DockState.DockLeftAutoHide:
|
|
{
|
|
Debug.Assert(SplitterSize == rect.Width);
|
|
e.Graphics.FillRectangle(_backgroundBrush, rect);
|
|
}
|
|
break;
|
|
case DockState.DockBottomAutoHide:
|
|
case DockState.DockTopAutoHide:
|
|
{
|
|
Debug.Assert(SplitterSize == rect.Height);
|
|
e.Graphics.FillRectangle(_horizontalBrush, rect);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|