Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Scheduling/HeuristicLab.ExtLibs/HeuristicLab.WinFormsUI/2.3.1/WinFormsUI-2.3.1/Docking/SplitterBase.cs @ 6040

Last change on this file since 6040 was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

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