70 lines
1.8 KiB
C#
70 lines
1.8 KiB
C#
|
|
using System.ComponentModel;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
#pragma warning disable CS1591 // ȱ<>ٶԹ<D9B6><D4B9><EFBFBD><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>Ա<EFBFBD><D4B1> XML ע<><D7A2>
|
|||
|
|
namespace WeifenLuo.WinFormsUI.Docking
|
|||
|
|
{
|
|||
|
|
[ToolboxItem(false)]
|
|||
|
|
public class SplitterBase : Control
|
|||
|
|
{
|
|||
|
|
public SplitterBase()
|
|||
|
|
{
|
|||
|
|
SetStyle(ControlStyles.Selectable, false);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override DockStyle Dock
|
|||
|
|
{
|
|||
|
|
get { return base.Dock; }
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
SuspendLayout();
|
|||
|
|
base.Dock = value;
|
|||
|
|
|
|||
|
|
if (Dock == DockStyle.Left || Dock == DockStyle.Right)
|
|||
|
|
Width = SplitterSize;
|
|||
|
|
else if (Dock == DockStyle.Top || Dock == DockStyle.Bottom)
|
|||
|
|
Height = SplitterSize;
|
|||
|
|
else
|
|||
|
|
Bounds = Rectangle.Empty;
|
|||
|
|
|
|||
|
|
if (Dock == DockStyle.Left || Dock == DockStyle.Right)
|
|||
|
|
Cursor = Cursors.VSplit;
|
|||
|
|
else if (Dock == DockStyle.Top || Dock == DockStyle.Bottom)
|
|||
|
|
Cursor = Cursors.HSplit;
|
|||
|
|
else
|
|||
|
|
Cursor = Cursors.Default;
|
|||
|
|
|
|||
|
|
ResumeLayout();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected virtual int SplitterSize
|
|||
|
|
{
|
|||
|
|
get { return 0; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected override void OnMouseDown(MouseEventArgs e)
|
|||
|
|
{
|
|||
|
|
base.OnMouseDown(e);
|
|||
|
|
|
|||
|
|
if (e.Button != MouseButtons.Left)
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
StartDrag();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected virtual void StartDrag()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected override void WndProc(ref Message m)
|
|||
|
|
{
|
|||
|
|
// eat the WM_MOUSEACTIVATE message
|
|||
|
|
if (m.Msg == (int)Win32.Msgs.WM_MOUSEACTIVATE)
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
base.WndProc(ref m);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|