| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:SplitterBase.cs
- * 2.功能描述:类文件
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 陈晓野 2014/09/01 1.00 新建
- *******************************************************************************/
- using System.Drawing;
- using System.Windows.Forms;
- namespace Dongke.IBOSS.PRD.Basics.DockPanel
- {
- internal 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);
- }
- }
- }
|