Free cookie consent management tool by TermsFeed Policy Generator

source: stable/HeuristicLab.ExtLibs/HeuristicLab.WinFormsUI/2.7.0/WinFormsUI-2.7.0/Docking/SplitterBase.cs

Last change on this file was 8616, checked in by mkommend, 12 years ago

#1939: Added DockPanelSuite 2.7.0 to ExtLibs.

File size: 1.4 KB
Line 
1using System;
2using System.Collections;
3using System.ComponentModel;
4using System.Drawing;
5using System.Windows.Forms;
6
7namespace WeifenLuo.WinFormsUI.Docking
8{
9  internal class SplitterBase : Control
10  {
11    public SplitterBase()
12    {
13      SetStyle(ControlStyles.Selectable, false);
14    }
15
16    public override DockStyle Dock
17    {
18      get { return base.Dock; }
19      set
20      {
21        SuspendLayout();
22        base.Dock = value;
23
24        if (Dock == DockStyle.Left || Dock == DockStyle.Right)
25          Width = SplitterSize;
26        else if (Dock == DockStyle.Top || Dock == DockStyle.Bottom)
27          Height = SplitterSize;
28        else
29          Bounds = Rectangle.Empty;
30
31        if (Dock == DockStyle.Left || Dock == DockStyle.Right)
32          Cursor = Cursors.VSplit;
33        else if (Dock == DockStyle.Top || Dock == DockStyle.Bottom)
34          Cursor = Cursors.HSplit;
35        else
36          Cursor = Cursors.Default;
37         
38        ResumeLayout();
39      }
40    }
41
42    protected virtual int SplitterSize
43    {
44      get { return 0; }
45    }
46
47    protected override void OnMouseDown(MouseEventArgs e)
48    {
49      base.OnMouseDown(e);
50
51      if (e.Button != MouseButtons.Left)
52        return;
53
54      StartDrag();
55    }
56
57    protected virtual void StartDrag()
58    {
59    }
60
61    protected override void WndProc(ref Message m)
62    {
63            // eat the WM_MOUSEACTIVATE message
64      if (m.Msg == (int)Win32.Msgs.WM_MOUSEACTIVATE)
65        return;
66
67      base.WndProc(ref m);
68    }
69  }
70}
Note: See TracBrowser for help on using the repository browser.