|
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Storm.Docking.Controls
{
/// <summary>
/// Represents a Splitter that can have a transparent background and
/// custom cursors depending on its DockStyle.
/// </summary>
[ToolboxItem(false)]
public class DockSplitter
: Splitter
{
#region Fields
private Cursor leftRightCursor = Cursors.SizeWE;
private Cursor topBottomCursor = Cursors.SizeNS;
#endregion
#region Properties
/// <summary>
/// Gets or sets the DockSplitter's dock side.
/// </summary>
public new DockStyle Dock
{
get { return base.Dock; }
set
{
base.Dock = value;
if (base.Dock == DockStyle.Left ||
base.Dock == DockStyle.Right)
{
this.Cursor = this.LeftRightCursor;
}
else if (base.Dock == DockStyle.Top ||
base.Dock == DockStyle.Bottom)
{
this.Cursor = this.TopBottomCursor;
}
}
}
/// <summary>
/// Gets or sets the Cursor that the DockSplitter will use when
/// it's docked to the left or right sides of the screen.
/// </summary>
public Cursor LeftRightCursor
{
get { return leftRightCursor; }
set
{
leftRightCursor = value;
this.Dock = this.Dock; // Reset Dock to update.
}
}
/// <summary>
/// Gets or sets the Cursor that the DockSplitter will use when
/// it's docked to the top or bottom sides of the screen.
/// </summary>
public Cursor TopBottomCursor
{
get { return topBottomCursor; }
set
{
topBottomCursor = value;
this.Dock = this.Dock; // Reset Dock to update.
}
}
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="DockSplitter"/> class.
/// </summary>
public DockSplitter()
: base()
{
// Call SetStyle to setup how we want the DockSplitter to act.
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.SetStyle(ControlStyles.Selectable, false);
// Set the base settings of the DockSplitter.
this.BackColor = Color.Transparent;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.