Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/WinFormsUI/Docking/SplitterBase.cs @ 2319

Last change on this file since 2319 was 2134, checked in by gkronber, 15 years ago

Added up to date source of Weifen Luo dock panel suit in a separate project (and added strong name key). Removed binary versions of Weifen Luo dock panel suite and references to it. #687 (Update AdvancedOptimizationFrontend to use more recent version of Weifen Luo Docking library)

File size: 1.4 KB
RevLine 
[2134]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.