RaUI/Source/ryControls/WeifenLuo.WinFormsUI/ThemeVS2012/VS2012PanelIndicatorFactory.cs
zilinsoft 3262955f2f ### 2023-11-07更新
------
#### RaUIV4    V4.0.2311.0701
- *.[全新]整合了MyDb、ryControls、MyDb_MySQL等dll文件到RaUI一个项目。
- *.[新增]新增ApkOp类,可以轻松获取APK信息。
- *.[新增]新增JsonExt扩展类,让Json操作更简单。
- *.[新增]新增WebP类,可以支持webp格式的图片。
- *.[改进]ryQuickSQL中的AddField方法改为自动替换已存在的同名值。
- *.[修复]ryQuickSQL中的AddFieldCalc方法无法正常计算的BUG。
2023-11-07 16:37:53 +08:00

128 lines
4.6 KiB
C#

using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
namespace WeifenLuo.WinFormsUI.ThemeVS2012
{
internal class VS2012PanelIndicatorFactory : DockPanelExtender.IPanelIndicatorFactory
{
public DockPanel.IPanelIndicator CreatePanelIndicator(DockStyle style, ThemeBase theme)
{
return new VS2012PanelIndicator(style, theme);
}
private class VS2012PanelIndicator : PictureBox, DockPanel.IPanelIndicator
{
private Image _imagePanelLeft;
private Image _imagePanelRight;
private Image _imagePanelTop;
private Image _imagePanelBottom;
private Image _imagePanelFill;
private Image _imagePanelLeftActive;
private Image _imagePanelRightActive;
private Image _imagePanelTopActive;
private Image _imagePanelBottomActive;
private Image _imagePanelFillActive;
public VS2012PanelIndicator(DockStyle dockStyle, ThemeBase theme)
{
_imagePanelLeft = theme.ImageService.DockIndicator_PanelLeft;
_imagePanelRight = theme.ImageService.DockIndicator_PanelRight;
_imagePanelTop = theme.ImageService.DockIndicator_PanelTop;
_imagePanelBottom = theme.ImageService.DockIndicator_PanelBottom;
_imagePanelFill = theme.ImageService.DockIndicator_PanelFill;
_imagePanelLeftActive = theme.ImageService.DockIndicator_PanelLeft;
_imagePanelRightActive = theme.ImageService.DockIndicator_PanelRight;
_imagePanelTopActive = theme.ImageService.DockIndicator_PanelTop;
_imagePanelBottomActive = theme.ImageService.DockIndicator_PanelBottom;
_imagePanelFillActive = theme.ImageService.DockIndicator_PanelFill;
m_dockStyle = dockStyle;
SizeMode = PictureBoxSizeMode.AutoSize;
Image = ImageInactive;
}
private DockStyle m_dockStyle;
private DockStyle DockStyle
{
get { return m_dockStyle; }
}
private DockStyle m_status;
public DockStyle Status
{
get { return m_status; }
set
{
if (value != DockStyle && value != DockStyle.None)
throw new InvalidEnumArgumentException();
if (m_status == value)
return;
m_status = value;
IsActivated = (m_status != DockStyle.None);
}
}
private Image ImageInactive
{
get
{
if (DockStyle == DockStyle.Left)
return _imagePanelLeft;
else if (DockStyle == DockStyle.Right)
return _imagePanelRight;
else if (DockStyle == DockStyle.Top)
return _imagePanelTop;
else if (DockStyle == DockStyle.Bottom)
return _imagePanelBottom;
else if (DockStyle == DockStyle.Fill)
return _imagePanelFill;
else
return null;
}
}
private Image ImageActive
{
get
{
if (DockStyle == DockStyle.Left)
return _imagePanelLeftActive;
else if (DockStyle == DockStyle.Right)
return _imagePanelRightActive;
else if (DockStyle == DockStyle.Top)
return _imagePanelTopActive;
else if (DockStyle == DockStyle.Bottom)
return _imagePanelBottomActive;
else if (DockStyle == DockStyle.Fill)
return _imagePanelFillActive;
else
return null;
}
}
private bool m_isActivated = false;
private bool IsActivated
{
get { return m_isActivated; }
set
{
m_isActivated = value;
Image = IsActivated ? ImageActive : ImageInactive;
}
}
public DockStyle HitTest(Point pt)
{
return this.Visible && ClientRectangle.Contains(PointToClient(pt)) ? DockStyle : DockStyle.None;
}
}
}
}