RaUI/Source/ryControls/WeifenLuo.WinFormsUI/Docking/DockPaneCaptionBase.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

111 lines
3.1 KiB
C#

using System;
using System.Drawing;
using System.Security.Permissions;
using System.Windows.Forms;
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
namespace WeifenLuo.WinFormsUI.Docking
{
public abstract class DockPaneCaptionBase : Control
{
protected internal DockPaneCaptionBase(DockPane pane)
{
m_dockPane = pane;
SetStyle(ControlStyles.OptimizedDoubleBuffer |
ControlStyles.ResizeRedraw |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.Selectable, false);
}
private DockPane m_dockPane;
public DockPane DockPane
{
get { return m_dockPane; }
}
protected DockPane.AppearanceStyle Appearance
{
get { return DockPane.Appearance; }
}
protected bool HasTabPageContextMenu
{
get { return DockPane.HasTabPageContextMenu; }
}
protected void ShowTabPageContextMenu(Point position)
{
DockPane.ShowTabPageContextMenu(this, position);
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
if (e.Button == MouseButtons.Right)
ShowTabPageContextMenu(new Point(e.X, e.Y));
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
if (e.Button == MouseButtons.Left &&
DockPane.DockPanel.AllowEndUserDocking &&
DockPane.AllowDockDragAndDrop &&
DockPane.ActiveContent != null &&
(!DockHelper.IsDockStateAutoHide(DockPane.DockState) || CanDragAutoHide))
{
DockPane.DockPanel.BeginDrag(DockPane);
}
}
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
protected override void WndProc(ref Message m)
{
if (m.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK)
{
if (DockHelper.IsDockStateAutoHide(DockPane.DockState))
{
DockPane.DockPanel.ActiveAutoHideContent = null;
return;
}
if (DockPane.IsFloat)
DockPane.RestoreToPanel();
else
DockPane.Float();
}
base.WndProc(ref m);
}
internal void RefreshChanges()
{
if (IsDisposed)
return;
OnRefreshChanges();
}
protected virtual void OnRightToLeftLayoutChanged()
{
}
protected virtual void OnRefreshChanges()
{
}
protected internal abstract int MeasureHeight();
/// <summary>
/// Gets a value indicating whether dock panel can be dragged when in auto hide mode.
/// Default is false.
/// </summary>
protected virtual bool CanDragAutoHide
{
get { return false; }
}
}
}