DotNet 4.8.1 build of DotNetBar
This commit is contained in:
@@ -0,0 +1,222 @@
|
||||
#if FRAMEWORK20
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
public class Office2007SuperTabItem : SuperTabItemBaseDisplay
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int Radius = 4;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for Office2007 style SuperTabItem base display
|
||||
/// </summary>
|
||||
/// <param name="tabItem">Associated SuperTabItem</param>
|
||||
public Office2007SuperTabItem(SuperTabItem tabItem)
|
||||
: base(tabItem)
|
||||
{
|
||||
}
|
||||
|
||||
#region TabItemPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the tab item GraphicsPath
|
||||
/// </summary>
|
||||
/// <returns>Tab path</returns>
|
||||
internal override GraphicsPath TabItemPath()
|
||||
{
|
||||
// Check to see if the user is supplying a path
|
||||
|
||||
GraphicsPath path = base.TabItemPath();
|
||||
|
||||
if (path != null)
|
||||
return (path);
|
||||
|
||||
// Supply the default path based upon
|
||||
// the current tab alignment
|
||||
|
||||
switch (TabItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Top:
|
||||
return (TopTabPath());
|
||||
|
||||
case eTabStripAlignment.Bottom:
|
||||
return (BottomTabPath());
|
||||
|
||||
case eTabStripAlignment.Left:
|
||||
return (LeftTabPath());
|
||||
|
||||
default:
|
||||
return (RightTabPath());
|
||||
}
|
||||
}
|
||||
|
||||
#region TopTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Create the Top tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath TopTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
r.Height += 2;
|
||||
|
||||
// Create the path
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle ar = new Rectangle(r.X, r.Y, Radius, Radius);
|
||||
|
||||
path.AddLine(r.X, r.Bottom, r.X, r.Top + Radius);
|
||||
path.AddArc(ar, 180, 90);
|
||||
|
||||
path.AddLine(r.X + Radius, r.Top, r.Right - Radius, r.Top);
|
||||
|
||||
ar.X = r.Right - Radius;
|
||||
path.AddArc(ar, 270, 90);
|
||||
|
||||
path.AddLine(r.Right, r.Top + Radius, r.Right, r.Bottom);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BottomTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the Bottom tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath BottomTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
{
|
||||
r.Y -= 2;
|
||||
r.Height += 2;
|
||||
}
|
||||
|
||||
// Create the path
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle ar = new
|
||||
Rectangle(r.Right - Radius, r.Bottom - Radius, Radius, Radius);
|
||||
|
||||
path.AddLine(r.Right, r.Top, r.Right, r.Bottom - Radius);
|
||||
path.AddArc(ar, 0, 90);
|
||||
|
||||
path.AddLine(r.Right - Radius, r.Bottom, r.X + Radius, r.Bottom);
|
||||
|
||||
ar.X = r.X;
|
||||
path.AddArc(ar, 90, 90);
|
||||
|
||||
path.AddLine(r.X, r.Bottom - Radius, r.X, r.Top);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LeftTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the Left tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath LeftTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Height -= 1;
|
||||
r.Width -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
r.Width += 2;
|
||||
|
||||
// Create the tab path
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle ar = new
|
||||
Rectangle(r.X, r.Bottom - Radius, Radius, Radius);
|
||||
|
||||
path.AddLine(r.Right, r.Bottom, r.X + Radius, r.Bottom);
|
||||
path.AddArc(ar, 90, 90);
|
||||
|
||||
path.AddLine(r.X, r.Bottom - Radius, r.X, r.Top + Radius);
|
||||
|
||||
ar.Y = r.Y;
|
||||
path.AddArc(ar, 180, 90);
|
||||
|
||||
path.AddLine(r.X + Radius, r.Top, r.Right, r.Top);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RightTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Create the Right tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath RightTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
{
|
||||
r.X -= 2;
|
||||
r.Width += 2;
|
||||
}
|
||||
|
||||
// Create the tab path
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle ar = new
|
||||
Rectangle(r.Right - Radius, r.Top, Radius, Radius);
|
||||
|
||||
path.AddLine(r.X, r.Top, r.Right - Radius, r.Top);
|
||||
path.AddArc(ar, 270, 90);
|
||||
|
||||
path.AddLine(r.Right, r.Top + Radius, r.Right, r.Bottom - Radius);
|
||||
|
||||
ar.Y = r.Bottom - Radius;
|
||||
path.AddArc(ar, 0, 90);
|
||||
|
||||
path.AddLine(r.Right - Radius, r.Bottom, r.X, r.Bottom);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,31 @@
|
||||
#if FRAMEWORK20
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
internal class Office2007SuperTabStrip : SuperTabStripBaseDisplay
|
||||
{
|
||||
/// <summary>
|
||||
/// Office2007 TabStrip base display constructor
|
||||
/// </summary>
|
||||
/// <param name="tabStripItem">Associated TabStrip</param>
|
||||
public Office2007SuperTabStrip(SuperTabStripItem tabStripItem)
|
||||
: base(tabStripItem)
|
||||
{
|
||||
}
|
||||
|
||||
#region Internal properties
|
||||
|
||||
/// <summary>
|
||||
/// Tab layout offsets
|
||||
/// </summary>
|
||||
internal override Size TabLayoutOffset
|
||||
{
|
||||
get { return (new Size(3, 2)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,378 @@
|
||||
#if FRAMEWORK20
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
public class Office2010BackstageSuperTabItem : SuperTabItemBaseDisplay
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int MarkerHeight = 7;
|
||||
private const int MarkerWidth = 13;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Office 2010 Backstage SuperTabItem display constructor
|
||||
/// </summary>
|
||||
/// <param name="tabItem">Associated SuperTabItem</param>
|
||||
public Office2010BackstageSuperTabItem(SuperTabItem tabItem)
|
||||
: base(tabItem)
|
||||
{
|
||||
}
|
||||
|
||||
#region DrawTabBorder
|
||||
|
||||
/// <summary>
|
||||
/// Draws the tab border
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="ct"></param>
|
||||
protected override void DrawTabBorder(Graphics g,
|
||||
GraphicsPath path, SuperTabItemStateColorTable ct)
|
||||
{
|
||||
base.DrawTabBorder(g, path, ct);
|
||||
|
||||
// Draw the Backstage selection marker
|
||||
|
||||
if (ct.SelectionMarker.IsEmpty == false)
|
||||
DrawSelMarker(g, ct);
|
||||
}
|
||||
|
||||
#region DrawSelMarker
|
||||
|
||||
/// <summary>
|
||||
/// Draws the Backstage SelectedItem marker
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
/// <param name="ct"></param>
|
||||
private void DrawSelMarker(Graphics g, SuperTabItemStateColorTable ct)
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
|
||||
Point[] pts;
|
||||
|
||||
switch (TabStripItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Top:
|
||||
r.X += (r.Width - MarkerWidth) / 2;
|
||||
r.Y = r.Bottom - MarkerHeight + 2;
|
||||
|
||||
r.Width = MarkerWidth;
|
||||
r.Height = MarkerHeight;
|
||||
|
||||
pts = new Point[] {
|
||||
new Point(r.X, r.Bottom),
|
||||
new Point(r.X + MarkerWidth / 2, r.Y),
|
||||
new Point(r.Right, r.Bottom)};
|
||||
|
||||
break;
|
||||
|
||||
case eTabStripAlignment.Left:
|
||||
r.X = r.Right - MarkerHeight + 2;
|
||||
r.Y += (r.Height - MarkerWidth) / 2;
|
||||
|
||||
r.Width = MarkerHeight;
|
||||
r.Height = MarkerWidth;
|
||||
|
||||
pts = new Point[] {
|
||||
new Point(r.Right, r.Bottom),
|
||||
new Point(r.X, r.Y + MarkerWidth / 2),
|
||||
new Point(r.Right, r.Y)};
|
||||
|
||||
break;
|
||||
|
||||
case eTabStripAlignment.Bottom:
|
||||
r.X += (r.Width - MarkerWidth) / 2;
|
||||
r.Y -= 3;
|
||||
|
||||
r.Width = MarkerWidth;
|
||||
r.Height = MarkerHeight;
|
||||
|
||||
pts = new Point[] {
|
||||
new Point(r.X, r.Y),
|
||||
new Point(r.X + MarkerWidth / 2, r.Bottom),
|
||||
new Point(r.Right, r.Y)};
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
r.X -= 3;
|
||||
r.Y += (r.Height - MarkerWidth) / 2;
|
||||
|
||||
r.Width = MarkerHeight;
|
||||
r.Height = MarkerWidth;
|
||||
|
||||
pts = new Point[] {
|
||||
new Point(r.X, r.Y),
|
||||
new Point(r.Right, r.Y + MarkerWidth / 2),
|
||||
new Point(r.X, r.Bottom)};
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
using (Brush br = new SolidBrush(ct.SelectionMarker))
|
||||
g.FillPolygon(br, pts);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region DrawTabItemBackground
|
||||
|
||||
/// <summary>
|
||||
/// DrawTabItemBackground
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="tabColors"></param>
|
||||
protected override void DrawTabItemBackground(Graphics g,
|
||||
GraphicsPath path, SuperTabItemStateColorTable tabColors)
|
||||
{
|
||||
Rectangle r = Rectangle.Round(path.GetBounds());
|
||||
|
||||
if (r.Width > 0 && r.Height > 0)
|
||||
{
|
||||
if (tabColors.Background.Colors != null)
|
||||
{
|
||||
if (tabColors.Background.Colors.Length == 1)
|
||||
{
|
||||
DrawTabItemSolidBackground(g, path, tabColors, r);
|
||||
|
||||
if (TabItem.IsSelected == true && !StyleManager.IsMetro(TabItem.EffectiveStyle))
|
||||
DrawTabItemHighLight(g, path, tabColors, r);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawTabItemGradientBackground(g, path, tabColors, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DrawTabItemHighLight
|
||||
|
||||
/// <summary>
|
||||
/// DrawTabItemHighLight
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="tabColors"></param>
|
||||
/// <param name="r"></param>
|
||||
private void DrawTabItemHighLight(
|
||||
Graphics g, GraphicsPath path, SuperTabItemStateColorTable tabColors, Rectangle r)
|
||||
{
|
||||
Region clip = g.Clip;
|
||||
g.SetClip(path, CombineMode.Intersect);
|
||||
|
||||
using (GraphicsPath path2 = new GraphicsPath())
|
||||
{
|
||||
Rectangle t = r;
|
||||
t.Inflate(r.Width / 3, r.Height / 3);
|
||||
|
||||
path2.AddEllipse(t);
|
||||
|
||||
using (PathGradientBrush pbr = new PathGradientBrush(path2))
|
||||
{
|
||||
pbr.CenterPoint = new
|
||||
PointF(r.X + r.Width / 2, r.Bottom - (r.Height / 4));
|
||||
|
||||
pbr.CenterColor = ControlPaint.LightLight(tabColors.Background.Colors[0]);
|
||||
pbr.SurroundColors = new Color[] {Color.Empty};
|
||||
|
||||
g.FillPath(pbr, path2);
|
||||
}
|
||||
}
|
||||
|
||||
g.Clip = clip;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TabItemPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the tab item GraphicsPath
|
||||
/// </summary>
|
||||
/// <returns>Tab path</returns>
|
||||
internal override GraphicsPath TabItemPath()
|
||||
{
|
||||
// Check to see if the user is supplying a path
|
||||
|
||||
GraphicsPath path = base.TabItemPath();
|
||||
|
||||
if (path != null)
|
||||
return (path);
|
||||
|
||||
// Supply the default path based upon
|
||||
// the current tab alignment
|
||||
|
||||
switch (TabItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Top:
|
||||
return (TopTabPath());
|
||||
|
||||
case eTabStripAlignment.Bottom:
|
||||
return (BottomTabPath());
|
||||
|
||||
case eTabStripAlignment.Left:
|
||||
return (LeftTabPath());
|
||||
|
||||
default:
|
||||
return (RightTabPath());
|
||||
}
|
||||
}
|
||||
|
||||
#region TopTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Create the Top tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath TopTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
r.Height += 2;
|
||||
|
||||
// Create the path
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
path.AddLines(new Point[]
|
||||
{
|
||||
new Point(r.X, r.Bottom),
|
||||
new Point(r.X, r.Top),
|
||||
new Point(r.Right, r.Top),
|
||||
new Point(r.Right, r.Bottom),
|
||||
});
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BottomTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the Bottom tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath BottomTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
{
|
||||
r.Y -= 2;
|
||||
r.Height += 2;
|
||||
}
|
||||
|
||||
// Create the path
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
path.AddLines(new Point[]
|
||||
{
|
||||
new Point(r.Right, r.Top),
|
||||
new Point(r.Right, r.Bottom),
|
||||
new Point(r.X, r.Bottom),
|
||||
new Point(r.X, r.Top),
|
||||
});
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LeftTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the Left tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath LeftTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
r.Width += 2;
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
// Create the tab path
|
||||
|
||||
path.AddLines(new Point[]
|
||||
{
|
||||
new Point(r.Right, r.Bottom),
|
||||
new Point(r.X, r.Bottom),
|
||||
new Point(r.X, r.Top),
|
||||
new Point(r.Right, r.Top),
|
||||
});
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RightTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Create the Right tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath RightTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
{
|
||||
r.X -= 2;
|
||||
r.Width += 2;
|
||||
}
|
||||
|
||||
// Create the tab path
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
path.AddLines(new Point[]
|
||||
{
|
||||
new Point(r.X, r.Top),
|
||||
new Point(r.Right, r.Top),
|
||||
new Point(r.Right, r.Bottom),
|
||||
new Point(r.X, r.Bottom),
|
||||
});
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,155 @@
|
||||
#if FRAMEWORK20
|
||||
using System.Drawing;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
using DevComponents.UI.ContentManager;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
internal class Office2010BackstageSuperTabStrip : SuperTabStripBaseDisplay
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int SelectedPadding = 5;
|
||||
private const int HvTabOverLap = -1;
|
||||
|
||||
#endregion
|
||||
|
||||
public Office2010BackstageSuperTabStrip(SuperTabStripItem tabStripItem)
|
||||
: base(tabStripItem)
|
||||
{
|
||||
tabStripItem.ControlBox.MenuBox.Style = eDotNetBarStyle.Office2010;
|
||||
}
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region PreDrawStripBorder
|
||||
|
||||
/// <summary>
|
||||
/// PreDrawStripBorder
|
||||
/// </summary>
|
||||
internal override bool PreDrawStripBorder
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SelectedPaddingWidth
|
||||
|
||||
/// <summary>
|
||||
/// SelectedPaddingWidth
|
||||
/// </summary>
|
||||
internal override int SelectedPaddingWidth
|
||||
{
|
||||
get { return (SelectedPadding); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region NextBlockPosition (LayoutManager)
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Layout manager NextBlockPosition
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void NextBlockPosition(LayoutManagerPositionEventArgs e)
|
||||
{
|
||||
BaseItem item = (BaseItem)e.Block;
|
||||
int n = Tabs.IndexOf(item);
|
||||
|
||||
if (n >= 0 && n + 1 < Tabs.Count)
|
||||
{
|
||||
SuperTabItem tab1 = Tabs[n] as SuperTabItem;
|
||||
|
||||
if (tab1 != null)
|
||||
{
|
||||
SuperTabItem tab2 = Tabs[n + 1] as SuperTabItem;
|
||||
|
||||
if (tab2 != null)
|
||||
{
|
||||
e.NextPosition = e.CurrentPosition;
|
||||
|
||||
if (TabStripItem.IsVertical == true)
|
||||
e.NextPosition.Y += (e.Block.Bounds.Height - HvTabOverLap);
|
||||
else
|
||||
e.NextPosition.X += (e.Block.Bounds.Width - HvTabOverLap);
|
||||
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region NextBlockPosition (PromoteSelTab)
|
||||
|
||||
/// <summary>
|
||||
/// Gets the "PromoteSelTab" NextBlockPosition
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="vItem"></param>
|
||||
/// <returns></returns>
|
||||
internal override Rectangle NextBlockPosition(BaseItem item, BaseItem vItem)
|
||||
{
|
||||
Rectangle r = base.NextBlockPosition(item, vItem);
|
||||
|
||||
if (item is SuperTabItem && vItem is SuperTabItem)
|
||||
{
|
||||
if (TabStripItem.IsVertical == true)
|
||||
r.Y -= HvTabOverLap;
|
||||
else
|
||||
r.X -= HvTabOverLap;
|
||||
}
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DrawBackground
|
||||
|
||||
/// <summary>
|
||||
/// Draws the background
|
||||
/// </summary>
|
||||
/// <param name="p"></param>
|
||||
/// <param name="ct"></param>
|
||||
protected override void DrawBackground(ItemPaintArgs p, SuperTabColorTable ct)
|
||||
{
|
||||
Graphics g = p.Graphics;
|
||||
Rectangle r = TabStripItem.DisplayRectangle;
|
||||
|
||||
int angle = ct.Background.GradientAngle;
|
||||
|
||||
switch (TabStripItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Bottom:
|
||||
r.Y -= 1;
|
||||
break;
|
||||
|
||||
case eTabStripAlignment.Right:
|
||||
r.X -= 1;
|
||||
break;
|
||||
|
||||
case eTabStripAlignment.Top:
|
||||
angle += 180;
|
||||
break;
|
||||
}
|
||||
|
||||
using (Brush lbr = ct.Background.GetBrush(r, angle))
|
||||
{
|
||||
SmoothingMode sm = g.SmoothingMode;
|
||||
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;
|
||||
if (lbr != null)
|
||||
g.FillRectangle(lbr, r);
|
||||
g.SmoothingMode = sm;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,290 @@
|
||||
#if FRAMEWORK20
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
public class OfficeMobile2014SuperTabItem : SuperTabItemBaseDisplay
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int Radius = 8;
|
||||
private const int Dia = Radius * 2;
|
||||
private const int Offset = 2;
|
||||
private const int StripeTop = 7;
|
||||
private const int StripeBot = 5;
|
||||
private const int PadFill = 3;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for OfficeMobile2014 style SuperTabItem base display
|
||||
/// </summary>
|
||||
/// <param name="tabItem">Associated SuperTabItem</param>
|
||||
public OfficeMobile2014SuperTabItem(SuperTabItem tabItem)
|
||||
: base(tabItem)
|
||||
{
|
||||
}
|
||||
|
||||
#region ContentRectangle
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the Content Rectangle for the tab
|
||||
/// </summary>
|
||||
/// <returns>Content Rectangle</returns>
|
||||
internal override Rectangle ContentRectangle()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
|
||||
int tabOverlap = (TabStripItem.TabDisplay.TabOverlap);
|
||||
int tabSpacing = (TabStripItem.TabDisplay.TabSpacing);
|
||||
int n = tabOverlap + tabSpacing;
|
||||
|
||||
if (TabStripItem.IsVertical == true)
|
||||
{
|
||||
r.Y += (tabOverlap / 2 + tabSpacing);
|
||||
r.Height -= (tabOverlap + tabSpacing * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
r.X += (tabOverlap / 2 + tabSpacing);
|
||||
r.Width -= (tabOverlap + tabSpacing * 2);
|
||||
}
|
||||
|
||||
int stripeTop = Dpi.Width(StripeTop);
|
||||
int padFill = Dpi.Width(PadFill);
|
||||
switch (TabItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Top:
|
||||
r.Height -= stripeTop;
|
||||
break;
|
||||
|
||||
case eTabStripAlignment.Bottom:
|
||||
r.Height -= StripeBot;
|
||||
r.Y += StripeBot;
|
||||
break;
|
||||
|
||||
case eTabStripAlignment.Left:
|
||||
if (TabStripItem.HorizontalText == false)
|
||||
{
|
||||
r.X -= padFill;
|
||||
r.Y += padFill;
|
||||
}
|
||||
|
||||
r.Width -= stripeTop;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (TabStripItem.HorizontalText == true)
|
||||
{
|
||||
r.X += padFill;
|
||||
r.Width -= StripeBot;
|
||||
}
|
||||
else
|
||||
{
|
||||
r.X += stripeTop;
|
||||
r.Width -= stripeTop;
|
||||
r.Height += stripeTop;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TabItemPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the tab item GraphicsPath
|
||||
/// </summary>
|
||||
/// <returns>Tab path</returns>
|
||||
internal override GraphicsPath TabItemPath()
|
||||
{
|
||||
GraphicsPath path = base.TabItemPath();
|
||||
|
||||
if (path != null)
|
||||
return (path);
|
||||
|
||||
switch (TabItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Top:
|
||||
return (TopTabPath());
|
||||
|
||||
case eTabStripAlignment.Bottom:
|
||||
return (BottomTabPath());
|
||||
|
||||
case eTabStripAlignment.Left:
|
||||
return (LeftTabPath());
|
||||
|
||||
default:
|
||||
return (RightTabPath());
|
||||
}
|
||||
}
|
||||
|
||||
#region TopTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Create the Top tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath TopTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= Dpi.Width1;
|
||||
r.Height -= Dpi.Height(StripeBot);
|
||||
|
||||
int k = Math.Min(20, r.Height);
|
||||
float scale = (float)k / 20;
|
||||
|
||||
int delta = (int)(90 * scale) - 25;
|
||||
int n = (int)((TabStripItem.TabDisplay.TabOverlap / 2) * scale);
|
||||
|
||||
// Create the path
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
int dia = Dpi.Width(Dia);
|
||||
Rectangle ar = new Rectangle(r.X - Dpi.Width(Radius), r.Bottom - dia, dia, dia);
|
||||
path.AddArc(ar, 90, -delta);
|
||||
|
||||
int offset = Dpi.Width(Offset);
|
||||
ar = new Rectangle(r.X + Dpi.Width(Radius) + Dpi.Width(offset), r.Y, dia, dia);
|
||||
path.AddArc(ar, 270 - delta, delta);
|
||||
|
||||
ar = new Rectangle(r.Right - (dia + offset + n), r.Y, dia, dia);
|
||||
path.AddArc(ar, 270, delta);
|
||||
|
||||
ar = new Rectangle(r.Right - (dia - offset * 2), r.Bottom - dia, dia, dia);
|
||||
path.AddArc(ar, 90 + delta, -delta);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BottomTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the Bottom tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath BottomTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= (StripeBot + 1);
|
||||
r.Y += StripeBot;
|
||||
|
||||
// Create the path
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
int k = Math.Min(20, r.Height);
|
||||
float scale = (float)k / 20;
|
||||
|
||||
int delta = (int)(90 * scale) - 25;
|
||||
int n = (int)((TabStripItem.TabDisplay.TabOverlap / 2) * scale);
|
||||
|
||||
Rectangle ar = new Rectangle(r.X - Radius, r.Y, Dia, Dia);
|
||||
path.AddArc(ar, 270, delta);
|
||||
|
||||
ar = new Rectangle(r.X + Radius + Offset, r.Bottom - Dia, Dia, Dia);
|
||||
path.AddArc(ar, 90 + delta, -delta);
|
||||
|
||||
ar = new Rectangle(r.Right - (Dia + Offset + n), r.Bottom - Dia, Dia, Dia);
|
||||
path.AddArc(ar, 90, -delta);
|
||||
|
||||
ar = new Rectangle(r.Right - (Dia - Offset * 2), r.Y, Dia, Dia);
|
||||
path.AddArc(ar, 270 - delta, delta);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LeftTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the Left tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath LeftTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= StripeBot;
|
||||
r.Height -= 1;
|
||||
|
||||
// Create the path
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
int k = Math.Min(20, r.Width);
|
||||
float scale = (float)k / 20;
|
||||
|
||||
int delta = (int)(90 * scale) - 25;
|
||||
int n = (int)((TabStripItem.TabDisplay.TabOverlap / 2) * scale);
|
||||
|
||||
Rectangle ar = new Rectangle(r.Right - Dia, r.Y - Radius, Dia, Dia);
|
||||
path.AddArc(ar, 0, delta);
|
||||
|
||||
ar = new Rectangle(r.X, r.Y + Offset + n, Dia, Dia);
|
||||
path.AddArc(ar, -180 + delta, -delta);
|
||||
|
||||
ar = new Rectangle(r.X, r.Bottom - Dia - Offset, Dia, Dia);
|
||||
path.AddArc(ar, 180, -delta);
|
||||
|
||||
ar = new Rectangle(r.Right - Dia, r.Bottom - Radius + n, Dia, Dia);
|
||||
path.AddArc(ar, -delta, delta);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RightTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Create the Right tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath RightTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.X += StripeBot;
|
||||
r.Width -= (StripeBot + 1);
|
||||
r.Height -= 1;
|
||||
|
||||
// Create the path
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
int k = Math.Min(20, r.Width);
|
||||
float scale = (float)k / 20;
|
||||
|
||||
int delta = (int)(90 * scale) - 25;
|
||||
int n = (int)((TabStripItem.TabDisplay.TabOverlap / 2) * scale);
|
||||
|
||||
Rectangle ar = new Rectangle(r.X, r.Y - Radius, Dia, Dia);
|
||||
path.AddArc(ar, 180, -delta);
|
||||
|
||||
ar = new Rectangle(r.Right - Dia, r.Y + Offset + n, Dia, Dia);
|
||||
path.AddArc(ar, -delta, delta);
|
||||
|
||||
ar = new Rectangle(r.Right - Dia, r.Bottom - Dia - Offset, Dia, Dia);
|
||||
path.AddArc(ar, 0, delta);
|
||||
|
||||
ar = new Rectangle(r.X, r.Bottom - Radius + n, Dia, Dia);
|
||||
path.AddArc(ar, 180 + delta, -delta);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,386 @@
|
||||
#if FRAMEWORK20
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
using DevComponents.UI.ContentManager;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
internal class OfficeMobile2014SuperTabStrip : SuperTabStripBaseDisplay
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private int HTabSpacing
|
||||
{
|
||||
get { return Dpi.Width4; }
|
||||
}
|
||||
|
||||
private int HTabOverLap
|
||||
{
|
||||
get { return Dpi.Width25; }
|
||||
}
|
||||
|
||||
private int VTabSpacing {
|
||||
get { return Dpi.Width4; }
|
||||
}
|
||||
|
||||
private int VTabOverLap {
|
||||
get { return Dpi.Width14; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// OfficeMobile2014 SuperTabStripBaseDisplay
|
||||
/// </summary>
|
||||
/// <param name="tabStripItem">Associated TabStripItem</param>
|
||||
public OfficeMobile2014SuperTabStrip(SuperTabStripItem tabStripItem)
|
||||
: base(tabStripItem)
|
||||
{
|
||||
}
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region MinTabSize
|
||||
|
||||
/// <summary>
|
||||
/// Returns the Minimum tab size for this style
|
||||
/// </summary>
|
||||
internal override Size MinTabSize
|
||||
{
|
||||
get
|
||||
{
|
||||
if (TabStripItem.IsVertical == false || TabStripItem.HorizontalText == true)
|
||||
return Dpi.Size(new Size(52, 20));
|
||||
|
||||
return Dpi.Size(new Size(36, 20));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TabLayoutOffset
|
||||
|
||||
/// <summary>
|
||||
/// Tab layout offsets
|
||||
/// </summary>
|
||||
internal override Size TabLayoutOffset
|
||||
{
|
||||
get { return Dpi.Size(new Size(5, 3)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TabOverlap
|
||||
|
||||
/// <summary>
|
||||
/// Tab Overlap
|
||||
/// </summary>
|
||||
internal override int TabOverlap
|
||||
{
|
||||
get { return (TabStripItem.IsVertical ? VTabOverLap : HTabOverLap); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TabSpacing
|
||||
|
||||
/// <summary>
|
||||
/// Tab Spacing
|
||||
/// </summary>
|
||||
internal override int TabSpacing
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (TabStripItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Top:
|
||||
case eTabStripAlignment.Bottom:
|
||||
return HTabSpacing;
|
||||
|
||||
case eTabStripAlignment.Right:
|
||||
return TabStripItem.HorizontalText == false ? HTabSpacing : VTabSpacing;
|
||||
|
||||
default:
|
||||
return VTabSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region NextBlockPosition
|
||||
|
||||
/// <summary>
|
||||
/// Gets the next layout block position
|
||||
/// </summary>
|
||||
/// <param name="e">LayoutManagerPositionEventArgs</param>
|
||||
protected override void NextBlockPosition(LayoutManagerPositionEventArgs e)
|
||||
{
|
||||
int n = Tabs.IndexOf((BaseItem)e.Block);
|
||||
|
||||
if (n >= 0 && n + 1 < Tabs.Count)
|
||||
{
|
||||
SuperTabItem tab1 = Tabs[n] as SuperTabItem;
|
||||
|
||||
if (tab1 != null)
|
||||
{
|
||||
SuperTabItem tab2 = Tabs[n + 1] as SuperTabItem;
|
||||
|
||||
if (tab2 != null)
|
||||
{
|
||||
e.NextPosition = e.CurrentPosition;
|
||||
|
||||
if (TabStripItem.IsVertical == true)
|
||||
e.NextPosition.Y += (e.Block.Bounds.Height - VTabOverLap);
|
||||
else
|
||||
e.NextPosition.X += (e.Block.Bounds.Width - HTabOverLap);
|
||||
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region NextBlockPosition
|
||||
|
||||
/// <summary>
|
||||
/// Gets the next block position when attempting
|
||||
/// to make a specific tab visible
|
||||
/// </summary>
|
||||
/// <param name="item">Potential item to replace</param>
|
||||
/// <param name="vItem">View item being placed</param>
|
||||
/// <returns>Block Rectangle</returns>
|
||||
internal override Rectangle NextBlockPosition(BaseItem item, BaseItem vItem)
|
||||
{
|
||||
Rectangle r = base.NextBlockPosition(item, vItem);
|
||||
|
||||
if (item is SuperTabItem && vItem is SuperTabItem)
|
||||
{
|
||||
if (TabStripItem.IsVertical == true)
|
||||
r.Y -= VTabOverLap;
|
||||
else
|
||||
r.X -= HTabOverLap;
|
||||
}
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AddDefaultPadding
|
||||
|
||||
internal override void AddDefaultPadding(ref Size size)
|
||||
{
|
||||
base.AddDefaultPadding(ref size);
|
||||
|
||||
if (TabStripItem.IsVertical == false || TabStripItem.HorizontalText == false)
|
||||
size.Height += Dpi.Height7;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DrawStripBorder
|
||||
|
||||
protected override void DrawStripBorder(ItemPaintArgs p, Rendering.SuperTabColorTable ct)
|
||||
{
|
||||
Graphics g = p.Graphics;
|
||||
|
||||
Rectangle t = TabStripItem.SelectedTab != null ?
|
||||
TabStripItem.SelectedTab.DisplayRectangle : Rectangle.Empty;
|
||||
|
||||
Rectangle r = GetStripeRect();
|
||||
|
||||
eTabState ts = GetTabState();
|
||||
SuperTabItemStateColorTable tct = TabStripItem.SelectedTab.GetTabColorTable(ts);
|
||||
|
||||
if (tct.Background.Colors != null)
|
||||
{
|
||||
using (Brush br = new SolidBrush(tct.Background.Colors[tct.Background.Colors.Length - 1]))
|
||||
{
|
||||
SmoothingMode mode = g.SmoothingMode;
|
||||
g.SmoothingMode = SmoothingMode.None;
|
||||
|
||||
g.FillRectangle(br, r);
|
||||
|
||||
g.SmoothingMode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
if (ct.InnerBorder.IsEmpty == false)
|
||||
RenderInnerBorder(g, ct, r, t);
|
||||
|
||||
if (ct.OuterBorder.IsEmpty == false)
|
||||
RenderOuterBorder(g, ct, r, t);
|
||||
}
|
||||
|
||||
#region RenderInnerBorder
|
||||
|
||||
private void RenderInnerBorder(Graphics g,
|
||||
Rendering.SuperTabColorTable ct, Rectangle r, Rectangle t)
|
||||
{
|
||||
using (Pen pen = new Pen(ct.InnerBorder))
|
||||
{
|
||||
switch (TabStripItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Top:
|
||||
if (t.X > r.X)
|
||||
g.DrawLine(pen, r.X, r.Y + Dpi.Height1, t.X + Dpi.Width4, r.Y + Dpi.Height1);
|
||||
|
||||
if (t.Right < r.Right)
|
||||
g.DrawLine(pen, t.Right - Dpi.Width4, r.Y + Dpi.Height1, r.Right - Dpi.Width1, r.Y + Dpi.Height1);
|
||||
|
||||
g.DrawLine(pen, r.X + Dpi.Width1, r.Y + Dpi.Height1, r.X + Dpi.Width1, r.Y + Dpi.Height7);
|
||||
g.DrawLine(pen, r.Right - Dpi.Width2, r.Y + Dpi.Height1, r.Right - Dpi.Width2, r.Y + Dpi.Height7);
|
||||
break;
|
||||
|
||||
case eTabStripAlignment.Bottom:
|
||||
if (t.X > r.X)
|
||||
g.DrawLine(pen, r.X, r.Bottom - 1, t.X + 3, r.Bottom - 1);
|
||||
|
||||
if (t.Right < r.Right)
|
||||
g.DrawLine(pen, t.Right - 3, r.Bottom - 1, r.Right - 1, r.Bottom - 1);
|
||||
|
||||
g.DrawLine(pen, r.X + 1, r.Bottom - 2, r.X + 1, r.Bottom - 7);
|
||||
g.DrawLine(pen, r.Right - 2, r.Bottom - 2, r.Right - 2, r.Bottom - 7);
|
||||
break;
|
||||
|
||||
case eTabStripAlignment.Left:
|
||||
if (t.Y > 0)
|
||||
g.DrawLine(pen, r.X + 1, r.Y, r.X + 1, t.Y + 3);
|
||||
|
||||
if (t.Bottom < r.Bottom)
|
||||
g.DrawLine(pen, r.X + 1, t.Bottom + 3, r.X + 1, r.Bottom - 3);
|
||||
|
||||
g.DrawLine(pen, r.X, r.Y + 1, r.X + 7, r.Y + 1);
|
||||
g.DrawLine(pen, r.X, r.Bottom - 2, r.X + 7, r.Bottom - 2);
|
||||
break;
|
||||
|
||||
case eTabStripAlignment.Right:
|
||||
if (t.Y > 0)
|
||||
g.DrawLine(pen, r.Right - 1, r.Y, r.Right - 1, t.Y + 3);
|
||||
|
||||
if (t.Bottom < r.Bottom)
|
||||
g.DrawLine(pen, r.Right - 1, t.Bottom + 2, r.Right - 1, r.Bottom - 1);
|
||||
|
||||
g.DrawLine(pen, r.X, r.Y + 1, r.Right, r.Y + 1);
|
||||
g.DrawLine(pen, r.X, r.Bottom - 2, r.Right, r.Bottom - 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RenderOuterBorder
|
||||
|
||||
private void RenderOuterBorder(Graphics g, SuperTabColorTable ct, Rectangle r, Rectangle t)
|
||||
{
|
||||
using (Pen pen = new Pen(ct.OuterBorder))
|
||||
{
|
||||
switch (TabStripItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Top:
|
||||
if (t.X > r.X)
|
||||
g.DrawLine(pen, r.X, r.Y, t.X + 4, r.Y);
|
||||
|
||||
if (t.Right < r.Right)
|
||||
g.DrawLine(pen, t.Right - 4, r.Y, r.Right - 2, r.Y);
|
||||
|
||||
g.DrawLine(pen, r.X, r.Y, r.X, r.Y + 7);
|
||||
g.DrawLine(pen, r.Right - 1, r.Y, r.Right - 1, r.Y + 7);
|
||||
break;
|
||||
|
||||
case eTabStripAlignment.Bottom:
|
||||
if (t.X > r.X)
|
||||
g.DrawLine(pen, r.X, r.Bottom, t.X, r.Bottom);
|
||||
|
||||
if (t.Right < r.Right)
|
||||
g.DrawLine(pen, t.Right, r.Bottom, r.Right - 2, r.Bottom);
|
||||
|
||||
g.DrawLine(pen, r.X, r.Bottom, r.X, r.Bottom - 7);
|
||||
g.DrawLine(pen, r.Right - 1, r.Bottom, r.Right - 1, r.Bottom - 7);
|
||||
break;
|
||||
|
||||
case eTabStripAlignment.Left:
|
||||
if (t.Y > 0)
|
||||
g.DrawLine(pen, r.X, r.Y, r.X, t.Y + 3);
|
||||
|
||||
if (t.Bottom < r.Bottom)
|
||||
g.DrawLine(pen, r.X, t.Bottom + 2, r.X, r.Bottom - 3);
|
||||
|
||||
g.DrawLine(pen, r.X, r.Y, r.X + 7, r.Y);
|
||||
g.DrawLine(pen, r.X, r.Bottom - 1, r.X + 7, r.Bottom - 1);
|
||||
break;
|
||||
|
||||
case eTabStripAlignment.Right:
|
||||
if (t.Y > 0)
|
||||
g.DrawLine(pen, r.Right, r.Y, r.Right, t.Y);
|
||||
|
||||
if (t.Bottom < r.Bottom)
|
||||
g.DrawLine(pen, r.Right, t.Bottom + 3, r.Right, r.Bottom - 1);
|
||||
|
||||
g.DrawLine(pen, r.X, r.Y, r.Right, r.Y);
|
||||
g.DrawLine(pen, r.X, r.Bottom - 1, r.Right, r.Bottom - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetStripeRect
|
||||
|
||||
private Rectangle GetStripeRect()
|
||||
{
|
||||
Rectangle r = TabStripItem.Bounds;
|
||||
|
||||
switch (TabStripItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Top:
|
||||
r.Y = r.Bottom - Dpi.Height7 - Dpi.Height1;
|
||||
break;
|
||||
|
||||
case eTabStripAlignment.Bottom:
|
||||
r.Y -= Dpi.Height1;
|
||||
r.Height = Dpi.Height7 + Dpi.Height1;
|
||||
break;
|
||||
|
||||
case eTabStripAlignment.Left:
|
||||
r.X = r.Right - Dpi.Width7 - Dpi.Width1;
|
||||
break;
|
||||
|
||||
default:
|
||||
r.X -= Dpi.Width1;
|
||||
r.Width = Dpi.Width7 + Dpi.Width1;
|
||||
break;
|
||||
}
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetTabState
|
||||
|
||||
private eTabState GetTabState()
|
||||
{
|
||||
SuperTabItem tab = TabStripItem.SelectedTab;
|
||||
|
||||
if (tab.Enabled == false)
|
||||
return (eTabState.Disabled);
|
||||
|
||||
return (tab.IsSelected ? eTabState.Selected : eTabState.Default);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,231 @@
|
||||
#if FRAMEWORK20
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
public class OneNote2007SuperTabItem : SuperTabItemBaseDisplay
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int Radius = 10;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for OneNote2007 style SuperTabItem base display
|
||||
/// </summary>
|
||||
/// <param name="tabItem">Associated SuperTabItem</param>
|
||||
public OneNote2007SuperTabItem(SuperTabItem tabItem)
|
||||
: base(tabItem)
|
||||
{
|
||||
}
|
||||
|
||||
#region ContentRectangle
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the Content Rectangle for the tab
|
||||
/// </summary>
|
||||
/// <returns>Content Rectangle</returns>
|
||||
internal override Rectangle ContentRectangle()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
|
||||
int n = TabStripItem.TabDisplay.TabOverlap + TabStripItem.TabDisplay.TabSpacing;
|
||||
|
||||
if (TabStripItem.IsVertical == true)
|
||||
r.Height -= n;
|
||||
else
|
||||
r.Width -= n;
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TabItemPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the tab item GraphicsPath
|
||||
/// </summary>
|
||||
/// <returns>Tab path</returns>
|
||||
internal override GraphicsPath TabItemPath()
|
||||
{
|
||||
GraphicsPath path = base.TabItemPath();
|
||||
|
||||
if (path != null)
|
||||
return (path);
|
||||
|
||||
switch (TabItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Top:
|
||||
return (TopTabPath());
|
||||
|
||||
case eTabStripAlignment.Bottom:
|
||||
return (BottomTabPath());
|
||||
|
||||
case eTabStripAlignment.Left:
|
||||
return (LeftTabPath());
|
||||
|
||||
default:
|
||||
return (RightTabPath());
|
||||
}
|
||||
}
|
||||
|
||||
#region TopTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Create the Top tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath TopTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
r.Height += 2;
|
||||
|
||||
// Create the path
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
int n = TabStripItem.TabDisplay.TabOverlap + TabStripItem.TabDisplay.TabSpacing * 2;
|
||||
|
||||
Rectangle ar = new Rectangle(r.X, r.Y, Radius, Radius);
|
||||
|
||||
path.AddLine(r.X, r.Bottom, r.X, r.Top + Radius);
|
||||
path.AddArc(ar, 180, 90);
|
||||
path.AddLine(r.Right - n, r.Top, r.Right, r.Bottom);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BottomTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the Bottom tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath BottomTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
{
|
||||
r.Y -= 2;
|
||||
r.Height += 2;
|
||||
}
|
||||
|
||||
// Create the path
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
int n = TabStripItem.TabDisplay.TabOverlap + TabStripItem.TabDisplay.TabSpacing * 2;
|
||||
|
||||
Rectangle ar = new
|
||||
Rectangle(r.X, r.Bottom - Radius, Radius, Radius);
|
||||
|
||||
path.AddLine(r.Right, r.Top, r.Right - n, r.Bottom);
|
||||
path.AddArc(ar, 90, 90);
|
||||
path.AddLine(r.X, r.Bottom - Radius, r.X, r.Top);
|
||||
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LeftTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the Left tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath LeftTabPath()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
r.Width += 2;
|
||||
|
||||
// Create the tab path
|
||||
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
int n = TabStripItem.TabDisplay.TabOverlap + TabStripItem.TabDisplay.TabSpacing;
|
||||
|
||||
Rectangle ar = new
|
||||
Rectangle(r.X, r.Top, Radius, Radius);
|
||||
|
||||
path.AddLine(r.Right, r.Top, r.X + Radius, r.Top);
|
||||
path.AddArc(ar, -90, -90);
|
||||
|
||||
path.AddLine(r.X, r.Top + Radius, r.X, r.Bottom - n);
|
||||
path.AddLine(r.X, r.Bottom - n, r.Right, r.Bottom);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RightTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Create the Right tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath RightTabPath()
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
{
|
||||
r.X -= 2;
|
||||
r.Width += 2;
|
||||
}
|
||||
|
||||
// Create the tab path
|
||||
|
||||
int n = TabStripItem.TabDisplay.TabOverlap + TabStripItem.TabDisplay.TabSpacing;
|
||||
|
||||
if (TabStripItem.HorizontalText == false)
|
||||
n += TabStripItem.TabDisplay.TabSpacing;
|
||||
|
||||
Rectangle ar = new
|
||||
Rectangle(r.Right - Radius, r.Top, Radius, Radius);
|
||||
|
||||
path.AddLine(r.X, r.Top, r.Right - Radius, r.Top);
|
||||
path.AddArc(ar, 270, 90);
|
||||
|
||||
path.AddLine(r.Right, r.Top + Radius, r.Right, r.Bottom - n);
|
||||
path.AddLine(r.Right, r.Bottom - n, r.X, r.Bottom);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,150 @@
|
||||
#if FRAMEWORK20
|
||||
using System.Drawing;
|
||||
using DevComponents.UI.ContentManager;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
internal class OneNote2007SuperTabStrip : SuperTabStripBaseDisplay
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int HTabSpacing = 5;
|
||||
private const int HTabOverLap = 10;
|
||||
|
||||
private const int VTabSpacing = 7;
|
||||
private const int VTabOverLap = 10;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// OneNote2007 SuperTabStripBaseDisplay
|
||||
/// </summary>
|
||||
/// <param name="tabStripItem">Associated TabStripItem</param>
|
||||
public OneNote2007SuperTabStrip(SuperTabStripItem tabStripItem)
|
||||
: base(tabStripItem)
|
||||
{
|
||||
}
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region MinTabSize
|
||||
|
||||
/// <summary>
|
||||
/// Returns the Minimum tab size for this style
|
||||
/// </summary>
|
||||
internal override Size MinTabSize
|
||||
{
|
||||
get
|
||||
{
|
||||
if (TabStripItem.IsVertical == true && TabStripItem.HorizontalText == true)
|
||||
return (new Size(28, 30));
|
||||
|
||||
return (new Size(28, 16));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TabOverlap
|
||||
|
||||
/// <summary>
|
||||
/// Tab Overlap
|
||||
/// </summary>
|
||||
internal override int TabOverlap
|
||||
{
|
||||
get { return (TabStripItem.IsVertical ? VTabOverLap : HTabOverLap); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TabSpacing
|
||||
|
||||
/// <summary>
|
||||
/// Tab Spacing
|
||||
/// </summary>
|
||||
internal override int TabSpacing
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (TabStripItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Top:
|
||||
case eTabStripAlignment.Bottom:
|
||||
return (HTabSpacing);
|
||||
|
||||
case eTabStripAlignment.Right:
|
||||
return (TabStripItem.HorizontalText == false ? HTabSpacing : VTabSpacing);
|
||||
|
||||
default:
|
||||
return (VTabSpacing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region NextBlockPosition
|
||||
|
||||
/// <summary>
|
||||
/// Gets the next layout block position
|
||||
/// </summary>
|
||||
/// <param name="e">LayoutManagerPositionEventArgs</param>
|
||||
protected override void NextBlockPosition(LayoutManagerPositionEventArgs e)
|
||||
{
|
||||
int n = Tabs.IndexOf((BaseItem)e.Block);
|
||||
|
||||
if (n >= 0 && n + 1 < Tabs.Count)
|
||||
{
|
||||
SuperTabItem tab1 = Tabs[n] as SuperTabItem;
|
||||
|
||||
if (tab1 != null)
|
||||
{
|
||||
SuperTabItem tab2 = Tabs[n + 1] as SuperTabItem;
|
||||
|
||||
if (tab2 != null)
|
||||
{
|
||||
e.NextPosition = e.CurrentPosition;
|
||||
|
||||
if (TabStripItem.IsVertical == true)
|
||||
e.NextPosition.Y += (e.Block.Bounds.Height - VTabOverLap);
|
||||
else
|
||||
e.NextPosition.X += (e.Block.Bounds.Width - HTabOverLap);
|
||||
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region NextBlockPosition
|
||||
|
||||
/// <summary>
|
||||
/// Gets the next block position when attempting
|
||||
/// to make a specific tab visible
|
||||
/// </summary>
|
||||
/// <param name="item">Potential item to replace</param>
|
||||
/// <param name="vItem">View item being placed</param>
|
||||
/// <returns>Block Rectangle</returns>
|
||||
internal override Rectangle NextBlockPosition(BaseItem item, BaseItem vItem)
|
||||
{
|
||||
Rectangle r = base.NextBlockPosition(item, vItem);
|
||||
|
||||
if (item is SuperTabItem && vItem is SuperTabItem)
|
||||
{
|
||||
if (TabStripItem.IsVertical == true)
|
||||
r.Y -= VTabOverLap;
|
||||
else
|
||||
r.X -= HTabOverLap;
|
||||
}
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,300 @@
|
||||
#if FRAMEWORK20
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.ComponentModel;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents Panel for the SuperTabControl
|
||||
/// </summary>
|
||||
///
|
||||
[ToolboxItem(false)]
|
||||
[Designer("DevComponents.DotNetBar.Design.SuperTabControlPanelDesigner, DevComponents.DotNetBar.Design, Version=14.1.0.37, Culture=neutral, PublicKeyToken=90f470f34c89ccaf")]
|
||||
public class SuperTabControlPanel : PanelControl
|
||||
{
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the tab colors have changed
|
||||
/// </summary>
|
||||
[Description("Occurs when the panel colors have changed.")]
|
||||
public event EventHandler<EventArgs> PanelColorChanged;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constants
|
||||
|
||||
private const string InfoText =
|
||||
"Drop controls on this panel to associate them with currently selected tab.";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Variables
|
||||
|
||||
private SuperTabItem _Tab;
|
||||
private ElementStyle _PanelStyle;
|
||||
private SuperTabPanelColorTable _PanelColor;
|
||||
|
||||
#endregion
|
||||
|
||||
public SuperTabControlPanel()
|
||||
{
|
||||
_PanelStyle = new ElementStyle();
|
||||
_PanelColor = new SuperTabPanelColorTable();
|
||||
|
||||
_PanelColor.ColorTableChanged += PanelColor_ColorTableChanged;
|
||||
}
|
||||
|
||||
#region Public property hiding
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public override ElementStyle Style
|
||||
{
|
||||
get { return base.Style; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public override ElementStyle StyleMouseDown
|
||||
{
|
||||
get { return base.Style; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public override ElementStyle StyleMouseOver
|
||||
{
|
||||
get { return base.Style; }
|
||||
}
|
||||
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override ImageLayout BackgroundImageLayout
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.BackgroundImageLayout;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.BackgroundImageLayout = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region DockStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets which edge of the parent container a control is docked to.
|
||||
/// </summary>
|
||||
[Browsable(false), DefaultValue(DockStyle.None)]
|
||||
public override DockStyle Dock
|
||||
{
|
||||
get { return (base.Dock); }
|
||||
set { base.Dock = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PanelColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets user specified tab panel display colors
|
||||
/// </summary>
|
||||
[Browsable(true), Category("Style")]
|
||||
[Description("Contains user specified tab panel display colors.")]
|
||||
public SuperTabPanelColorTable PanelColor
|
||||
{
|
||||
get { return (_PanelColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_PanelColor.Equals(value) == false)
|
||||
{
|
||||
if (_PanelColor != null)
|
||||
_PanelColor.ColorTableChanged -= PanelColor_ColorTableChanged;
|
||||
|
||||
_PanelColor = value;
|
||||
|
||||
if (value != null)
|
||||
_PanelColor.ColorTableChanged += PanelColor_ColorTableChanged;
|
||||
|
||||
OnPanelColorChanged();
|
||||
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializePanelColor()
|
||||
{
|
||||
return (_PanelColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void ResetPanelColor()
|
||||
{
|
||||
PanelColor = new SuperTabPanelColorTable();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PanelStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Panel ElementStyle
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
public ElementStyle PanelStyle
|
||||
{
|
||||
get { return (_PanelStyle); }
|
||||
|
||||
set
|
||||
{
|
||||
_PanelStyle = value;
|
||||
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuperTabItem
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets TabItem that this panel is attached to.
|
||||
/// </summary>
|
||||
[Browsable(false), DefaultValue(null)]
|
||||
public SuperTabItem TabItem
|
||||
{
|
||||
get { return (_Tab); }
|
||||
set { _Tab = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BackgroundImage
|
||||
[Browsable(true), EditorBrowsable(EditorBrowsableState.Always), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public override Image BackgroundImage
|
||||
{
|
||||
get { return base.BackgroundImage; }
|
||||
set { base.BackgroundImage = value; }
|
||||
}
|
||||
protected override void OnBackgroundImageChanged(EventArgs e)
|
||||
{
|
||||
OnPanelColorChanged();
|
||||
base.OnBackgroundImageChanged(e);
|
||||
}
|
||||
private eStyleBackgroundImage _BackgroundImagePosition = eStyleBackgroundImage.Stretch;
|
||||
/// <summary>
|
||||
/// Specifies background image position when container is larger than image.
|
||||
/// </summary>
|
||||
[Browsable(true), Category("Appearance"), DefaultValue(eStyleBackgroundImage.Stretch), Description("Specifies background image position when container is larger than image.")]
|
||||
public eStyleBackgroundImage BackgroundImagePosition
|
||||
{
|
||||
get { return _BackgroundImagePosition; }
|
||||
set
|
||||
{
|
||||
if (_BackgroundImagePosition != value)
|
||||
{
|
||||
_BackgroundImagePosition = value;
|
||||
OnPanelColorChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region PanelColor_ColorTableChanged
|
||||
|
||||
/// <summary>
|
||||
/// _PanelColor_ColorTableChanged
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void PanelColor_ColorTableChanged(object sender, EventArgs e)
|
||||
{
|
||||
OnPanelColorChanged();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnPanelColorChanged
|
||||
|
||||
/// <summary>
|
||||
/// Processes ColorTable changes
|
||||
/// </summary>
|
||||
protected void OnPanelColorChanged()
|
||||
{
|
||||
if (PanelColorChanged != null)
|
||||
PanelColorChanged(this, EventArgs.Empty);
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetStyle
|
||||
|
||||
/// <summary>
|
||||
/// GetStyle
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected override ElementStyle GetStyle()
|
||||
{
|
||||
if (_PanelStyle != null)
|
||||
return (_PanelStyle);
|
||||
|
||||
return (Style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnPaint
|
||||
|
||||
/// <summary>
|
||||
/// Provides OnPaint support
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
if (ClientRectangle.Width > 0 && ClientRectangle.Height > 0)
|
||||
{
|
||||
SuperTabControl tab = Parent as SuperTabControl;
|
||||
|
||||
if (tab != null && tab.SelectedPanel == this)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
if (this.DesignMode && this.Controls.Count == 0 && this.Text == "")
|
||||
{
|
||||
Rectangle r = this.ClientRectangle;
|
||||
r.Inflate(-2, -2);
|
||||
|
||||
const eTextFormat sf = eTextFormat.Default | eTextFormat.VerticalCenter |
|
||||
eTextFormat.HorizontalCenter | eTextFormat.EndEllipsis |
|
||||
eTextFormat.WordBreak;
|
||||
|
||||
using (Font font = new Font(this.Font, FontStyle.Bold))
|
||||
{
|
||||
TextDrawing.DrawString(e.Graphics, InfoText,
|
||||
font, ControlPaint.Dark(this.Style.BackColor), r, sf);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,430 @@
|
||||
#if FRAMEWORK20
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
public class SuperTabCloseBox : BaseItem
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private SuperTabControlBox _ControlBox;
|
||||
private Size _ItemSize = new Size(16, 16);
|
||||
|
||||
private bool _IsMouseOver;
|
||||
private bool _IsMouseDown;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="controlBox">Associated SuperTabControlBox</param>
|
||||
public SuperTabCloseBox(SuperTabControlBox controlBox)
|
||||
{
|
||||
_ControlBox = controlBox;
|
||||
|
||||
Visible = false;
|
||||
}
|
||||
|
||||
#region Public override designer hiding
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool BeginGroup
|
||||
{
|
||||
get { return base.BeginGroup; }
|
||||
set { base.BeginGroup = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool AutoCollapseOnClick
|
||||
{
|
||||
get { return base.AutoCollapseOnClick; }
|
||||
set { base.AutoCollapseOnClick = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool CanCustomize
|
||||
{
|
||||
get { return base.CanCustomize; }
|
||||
set { base.CanCustomize = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string Category
|
||||
{
|
||||
get { return base.Category; }
|
||||
set { base.Category = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool ClickAutoRepeat
|
||||
{
|
||||
get { return base.ClickAutoRepeat; }
|
||||
set { base.ClickAutoRepeat = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override int ClickRepeatInterval
|
||||
{
|
||||
get { return base.ClickRepeatInterval; }
|
||||
set { base.ClickRepeatInterval = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override Cursor Cursor
|
||||
{
|
||||
get { return base.Cursor; }
|
||||
set { base.Cursor = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool Enabled
|
||||
{
|
||||
get { return base.Enabled; }
|
||||
set { base.Enabled = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool Stretch
|
||||
{
|
||||
get { return base.Stretch; }
|
||||
set { base.Stretch = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string Text
|
||||
{
|
||||
get { return base.Text; }
|
||||
set { base.Text = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool ThemeAware
|
||||
{
|
||||
get { return base.ThemeAware; }
|
||||
set { base.ThemeAware = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string Tooltip
|
||||
{
|
||||
get { return base.Tooltip; }
|
||||
set { base.Tooltip = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override eItemAlignment ItemAlignment
|
||||
{
|
||||
get { return base.ItemAlignment; }
|
||||
set { base.ItemAlignment = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string KeyTips
|
||||
{
|
||||
get { return base.KeyTips; }
|
||||
set { base.KeyTips = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override ShortcutsCollection Shortcuts
|
||||
{
|
||||
get { return base.Shortcuts; }
|
||||
set { base.Shortcuts = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string Description
|
||||
{
|
||||
get { return base.Description; }
|
||||
set { base.Description = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool GlobalItem
|
||||
{
|
||||
get { return base.GlobalItem; }
|
||||
set { base.GlobalItem = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool ShowSubItems
|
||||
{
|
||||
get { return base.ShowSubItems; }
|
||||
set { base.ShowSubItems = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string GlobalName
|
||||
{
|
||||
get { return base.GlobalName; }
|
||||
set { base.GlobalName = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override Command Command
|
||||
{
|
||||
get { return base.Command; }
|
||||
set { base.Command = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override object CommandParameter
|
||||
{
|
||||
get { return base.CommandParameter; }
|
||||
set { base.CommandParameter = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Visible
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CloseBox Visible state
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(false), Category("Behavior")]
|
||||
[Description("Indicates CloseBox Visible state.")]
|
||||
public override bool Visible
|
||||
{
|
||||
get { return base.Visible; }
|
||||
|
||||
set
|
||||
{
|
||||
if (base.Visible != value)
|
||||
{
|
||||
base.Visible = value;
|
||||
|
||||
MyRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region IsMouseDown
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the mouse is down
|
||||
/// </summary>
|
||||
internal bool IsMouseDown
|
||||
{
|
||||
get { return (_IsMouseDown); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsMouseOver
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the mouse is over the CloseBox
|
||||
/// </summary>
|
||||
internal bool IsMouseOver
|
||||
{
|
||||
get { return (_IsMouseOver); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region RecalcSize
|
||||
|
||||
/// <summary>
|
||||
/// Performs RecalcSize processing
|
||||
/// </summary>
|
||||
public override void RecalcSize()
|
||||
{
|
||||
base.RecalcSize();
|
||||
|
||||
WidthInternal = _ItemSize.Width;
|
||||
HeightInternal = _ItemSize.Height;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MyRefresh
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes the CloseBox
|
||||
/// </summary>
|
||||
private void MyRefresh()
|
||||
{
|
||||
if (_ControlBox.TabDisplay != null)
|
||||
{
|
||||
SuperTabStripItem tsi = _ControlBox.TabDisplay.TabStripItem;
|
||||
|
||||
if (tsi != null)
|
||||
{
|
||||
_ControlBox.NeedRecalcSize = true;
|
||||
_ControlBox.RecalcSize();
|
||||
|
||||
tsi.NeedRecalcSize = true;
|
||||
tsi.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Paint
|
||||
|
||||
/// <summary>
|
||||
/// Performs control Paint processing
|
||||
/// </summary>
|
||||
/// <param name="p"></param>
|
||||
public override void Paint(ItemPaintArgs p)
|
||||
{
|
||||
Graphics g = p.Graphics;
|
||||
|
||||
using (SuperTabColorTable sct = _ControlBox.TabDisplay.GetColorTable())
|
||||
{
|
||||
|
||||
Color imageColor = sct.ControlBoxDefault.Image;
|
||||
|
||||
if (_IsMouseOver == true)
|
||||
{
|
||||
Rectangle r = Bounds;
|
||||
|
||||
r.Width--;
|
||||
r.Height--;
|
||||
|
||||
if (_IsMouseDown == true && _IsMouseOver == true)
|
||||
{
|
||||
imageColor = sct.ControlBoxPressed.Image;
|
||||
|
||||
using (Brush br = new SolidBrush(sct.ControlBoxPressed.Background))
|
||||
g.FillRectangle(br, r);
|
||||
|
||||
using (Pen pen = new Pen(sct.ControlBoxPressed.Border))
|
||||
g.DrawRectangle(pen, r);
|
||||
}
|
||||
else
|
||||
{
|
||||
imageColor = sct.ControlBoxMouseOver.Image;
|
||||
|
||||
using (Brush br = new SolidBrush(sct.ControlBoxMouseOver.Background))
|
||||
g.FillRectangle(br, r);
|
||||
|
||||
using (Pen pen = new Pen(sct.ControlBoxMouseOver.Border))
|
||||
g.DrawRectangle(pen, r);
|
||||
}
|
||||
}
|
||||
|
||||
g.DrawImageUnscaled(
|
||||
_ControlBox.TabDisplay.GetCloseButton(g, imageColor), Bounds);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region InternalMouseEnter
|
||||
|
||||
/// <summary>
|
||||
/// InternalMouseEnter
|
||||
/// </summary>
|
||||
public override void InternalMouseEnter()
|
||||
{
|
||||
base.InternalMouseEnter();
|
||||
|
||||
_IsMouseOver = true;
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InternalMouseLeave
|
||||
|
||||
/// <summary>
|
||||
/// InternalMouseLeave
|
||||
/// </summary>
|
||||
public override void InternalMouseLeave()
|
||||
{
|
||||
base.InternalMouseLeave();
|
||||
|
||||
_IsMouseOver = false;
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InternalMouseDown
|
||||
|
||||
/// <summary>
|
||||
/// InternalMouseDown
|
||||
/// </summary>
|
||||
/// <param name="objArg"></param>
|
||||
public override void InternalMouseDown(MouseEventArgs objArg)
|
||||
{
|
||||
base.InternalMouseDown(objArg);
|
||||
|
||||
if (DesignMode == false && objArg.Button == MouseButtons.Left)
|
||||
_IsMouseDown = true;
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InternalMouseUp
|
||||
|
||||
/// <summary>
|
||||
/// InternalMouseUp
|
||||
/// </summary>
|
||||
/// <param name="objArg"></param>
|
||||
public override void InternalMouseUp(MouseEventArgs objArg)
|
||||
{
|
||||
base.InternalMouseUp(objArg);
|
||||
|
||||
_IsMouseDown = false;
|
||||
|
||||
if (_IsMouseOver == true)
|
||||
{
|
||||
SuperTabItem tab = _ControlBox.TabDisplay.SelectedTab;
|
||||
|
||||
if (tab != null)
|
||||
tab.Close();
|
||||
}
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy object support
|
||||
|
||||
/// <summary>
|
||||
/// Returns copy of the item
|
||||
/// </summary>
|
||||
public override BaseItem Copy()
|
||||
{
|
||||
SuperTabCloseBox objCopy = new SuperTabCloseBox(_ControlBox);
|
||||
CopyToItem(objCopy);
|
||||
|
||||
return (objCopy);
|
||||
}
|
||||
|
||||
protected override void CopyToItem(BaseItem copy)
|
||||
{
|
||||
SuperTabCloseBox objCopy = copy as SuperTabCloseBox;
|
||||
base.CopyToItem(objCopy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,666 @@
|
||||
#if FRAMEWORK20
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
public class SuperTabControlBox : BaseItem
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private SuperTabStripItem _TabStripItem;
|
||||
|
||||
private SuperTabCloseBox _CloseBox;
|
||||
private SuperTabMenuBox _MenuBox;
|
||||
|
||||
private BaseItem _HotItem;
|
||||
private BaseItem _MouseDownItem;
|
||||
|
||||
private bool _IsMouseOver;
|
||||
private bool _IsMouseDown;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="tabStripItem">Associated SuperTabStripItem</param>
|
||||
public SuperTabControlBox(SuperTabStripItem tabStripItem)
|
||||
{
|
||||
_TabStripItem = tabStripItem;
|
||||
|
||||
MouseDownCapture = true;
|
||||
MouseUpNotification = true;
|
||||
|
||||
Style = eDotNetBarStyle.Office2007;
|
||||
|
||||
_MenuBox = new SuperTabMenuBox(this);
|
||||
_CloseBox = new SuperTabCloseBox(this);
|
||||
|
||||
_MenuBox.Visible = true;
|
||||
_CloseBox.Visible = false;
|
||||
|
||||
SetParent(tabStripItem);
|
||||
SetIsContainer(true);
|
||||
|
||||
SubItems.Add(_MenuBox);
|
||||
SubItems.Add(_CloseBox);
|
||||
}
|
||||
|
||||
#region Public override designer hiding
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool BeginGroup
|
||||
{
|
||||
get { return base.BeginGroup; }
|
||||
set { base.BeginGroup = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool AutoCollapseOnClick
|
||||
{
|
||||
get { return base.AutoCollapseOnClick; }
|
||||
set { base.AutoCollapseOnClick = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool CanCustomize
|
||||
{
|
||||
get { return base.CanCustomize; }
|
||||
set { base.CanCustomize = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string Category
|
||||
{
|
||||
get { return base.Category; }
|
||||
set { base.Category = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool ClickAutoRepeat
|
||||
{
|
||||
get { return base.ClickAutoRepeat; }
|
||||
set { base.ClickAutoRepeat = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override int ClickRepeatInterval
|
||||
{
|
||||
get { return base.ClickRepeatInterval; }
|
||||
set { base.ClickRepeatInterval = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override Cursor Cursor
|
||||
{
|
||||
get { return base.Cursor; }
|
||||
set { base.Cursor = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool Enabled
|
||||
{
|
||||
get { return base.Enabled; }
|
||||
set { base.Enabled = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool Stretch
|
||||
{
|
||||
get { return base.Stretch; }
|
||||
set { base.Stretch = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string Text
|
||||
{
|
||||
get { return base.Text; }
|
||||
set { base.Text = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool ThemeAware
|
||||
{
|
||||
get { return base.ThemeAware; }
|
||||
set { base.ThemeAware = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string Tooltip
|
||||
{
|
||||
get { return base.Tooltip; }
|
||||
set { base.Tooltip = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override eItemAlignment ItemAlignment
|
||||
{
|
||||
get { return base.ItemAlignment; }
|
||||
set { base.ItemAlignment = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string KeyTips
|
||||
{
|
||||
get { return base.KeyTips; }
|
||||
set { base.KeyTips = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override ShortcutsCollection Shortcuts
|
||||
{
|
||||
get { return base.Shortcuts; }
|
||||
set { base.Shortcuts = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string Description
|
||||
{
|
||||
get { return base.Description; }
|
||||
set { base.Description = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool GlobalItem
|
||||
{
|
||||
get { return base.GlobalItem; }
|
||||
set { base.GlobalItem = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool ShowSubItems
|
||||
{
|
||||
get { return base.ShowSubItems; }
|
||||
set { base.ShowSubItems = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string GlobalName
|
||||
{
|
||||
get { return base.GlobalName; }
|
||||
set { base.GlobalName = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override Command Command
|
||||
{
|
||||
get { return base.Command; }
|
||||
set { base.Command = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override object CommandParameter
|
||||
{
|
||||
get { return base.CommandParameter; }
|
||||
set { base.CommandParameter = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Bounds
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ControlBox Bounds
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
public override Rectangle Bounds
|
||||
{
|
||||
get { return (base.Bounds); }
|
||||
|
||||
set
|
||||
{
|
||||
if (base.Bounds.Equals(value) == false)
|
||||
{
|
||||
base.Bounds = value;
|
||||
|
||||
RecalcLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CloseBox
|
||||
|
||||
/// <summary>
|
||||
/// Gets the CloseBox
|
||||
/// </summary>
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public SuperTabCloseBox CloseBox
|
||||
{
|
||||
get { return (_CloseBox); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MenuBox
|
||||
|
||||
/// <summary>
|
||||
/// Gets the MenuBox
|
||||
/// </summary>
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public SuperTabMenuBox MenuBox
|
||||
{
|
||||
get { return (_MenuBox); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Visible
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ControlBox Visible state
|
||||
/// </summary>
|
||||
public override bool Visible
|
||||
{
|
||||
get { return base.Visible; }
|
||||
|
||||
set
|
||||
{
|
||||
if (base.Visible != value)
|
||||
{
|
||||
base.Visible = value;
|
||||
|
||||
MyRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region IsMouseDown
|
||||
|
||||
/// <summary>
|
||||
/// Gets the MouseDown state
|
||||
/// </summary>
|
||||
internal bool IsMouseDown
|
||||
{
|
||||
get { return (_IsMouseDown); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsMouseOver
|
||||
|
||||
/// <summary>
|
||||
/// Gets the MouseOver state
|
||||
/// </summary>
|
||||
internal bool IsMouseOver
|
||||
{
|
||||
get { return (_IsMouseOver); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TabDisplay
|
||||
|
||||
/// <summary>
|
||||
/// Gets the TabStrip TabDisplay
|
||||
/// </summary>
|
||||
internal SuperTabStripBaseDisplay TabDisplay
|
||||
{
|
||||
get { return (_TabStripItem.TabDisplay); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region RecalcSize
|
||||
|
||||
/// <summary>
|
||||
/// Performs RecalcSize processing
|
||||
/// </summary>
|
||||
public override void RecalcSize()
|
||||
{
|
||||
Size size = Size.Empty;
|
||||
|
||||
foreach (BaseItem item in SubItems)
|
||||
size = LayoutItem(item, size, true);
|
||||
|
||||
WidthInternal = size.Width;
|
||||
HeightInternal = size.Height;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RecalcLayout
|
||||
|
||||
/// <summary>
|
||||
/// Performs RecalcLayout processing
|
||||
/// </summary>
|
||||
private void RecalcLayout()
|
||||
{
|
||||
Size size = Size.Empty;
|
||||
|
||||
if (_TabStripItem.IsRightToLeft)
|
||||
{
|
||||
int closeIndex = SubItems.IndexOf(_CloseBox);
|
||||
int menuIndex = SubItems.IndexOf(_MenuBox);
|
||||
|
||||
if (menuIndex >= 0 && closeIndex > menuIndex)
|
||||
{
|
||||
SubItems.Remove(_CloseBox);
|
||||
SubItems.Insert(menuIndex, _CloseBox);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (BaseItem item in SubItems)
|
||||
size = LayoutItem(item, size, false);
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LayoutItem
|
||||
|
||||
/// <summary>
|
||||
/// Performs individual running layout processing for the given BaseItem
|
||||
/// </summary>
|
||||
/// <param name="item">Item to Layout</param>
|
||||
/// <param name="size">Running Layout Size</param>
|
||||
/// <param name="recalc">Whether a recalcSize is needed</param>
|
||||
/// <returns>New running Size</returns>
|
||||
private Size LayoutItem(BaseItem item, Size size, bool recalc)
|
||||
{
|
||||
if (item.Visible == true)
|
||||
{
|
||||
// Recalc if requested
|
||||
|
||||
if (recalc == true)
|
||||
item.RecalcSize();
|
||||
|
||||
// If this is the first item, then give
|
||||
// us a little padding around the ControlBox
|
||||
|
||||
if (size.IsEmpty == true)
|
||||
{
|
||||
if (Orientation == eOrientation.Horizontal)
|
||||
size.Width += Dpi.Width5;
|
||||
else
|
||||
size.Height += Dpi.Height5;
|
||||
}
|
||||
|
||||
// Get the item Bounds
|
||||
|
||||
Rectangle r = new Rectangle(Bounds.X, Bounds.Y, item.WidthInternal, item.HeightInternal);
|
||||
|
||||
// Set the item location
|
||||
|
||||
if (_TabStripItem.IsVertical == true)
|
||||
{
|
||||
r.Y += size.Height;
|
||||
r.X += (Bounds.Width - r.Width) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
r.X += size.Width;
|
||||
r.Y += (Bounds.Height - r.Height) / 2;
|
||||
}
|
||||
|
||||
// Set the Bounds
|
||||
|
||||
item.Bounds = r;
|
||||
|
||||
// Set the item Size
|
||||
|
||||
if (_TabStripItem.IsVertical == true)
|
||||
{
|
||||
size.Height += item.HeightInternal + Dpi.Height2;
|
||||
|
||||
if (item.WidthInternal > size.Width)
|
||||
size.Width = item.WidthInternal;
|
||||
}
|
||||
else
|
||||
{
|
||||
size.Width += item.WidthInternal + Dpi.Width2;
|
||||
|
||||
if (item.HeightInternal > size.Height)
|
||||
size.Height = item.HeightInternal;
|
||||
}
|
||||
|
||||
// Set its display status
|
||||
|
||||
if (DesignMode == false)
|
||||
item.Displayed = true;
|
||||
}
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MyRefresh
|
||||
|
||||
/// <summary>
|
||||
/// Refresh code
|
||||
/// </summary>
|
||||
private void MyRefresh()
|
||||
{
|
||||
if (TabDisplay != null)
|
||||
{
|
||||
SuperTabStripItem tsi = TabDisplay.TabStripItem;
|
||||
|
||||
if (tsi != null)
|
||||
{
|
||||
tsi.NeedRecalcSize = true;
|
||||
tsi.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Paint
|
||||
|
||||
/// <summary>
|
||||
/// Paint processing
|
||||
/// </summary>
|
||||
/// <param name="p"></param>
|
||||
public override void Paint(ItemPaintArgs p)
|
||||
{
|
||||
foreach (BaseItem item in SubItems)
|
||||
{
|
||||
if (item.Visible == true)
|
||||
item.Paint(p);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region InternalMouseEnter
|
||||
|
||||
/// <summary>
|
||||
/// InternalMouseEnter
|
||||
/// </summary>
|
||||
public override void InternalMouseEnter()
|
||||
{
|
||||
base.InternalMouseEnter();
|
||||
|
||||
_IsMouseOver = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InternalMouseLeave
|
||||
|
||||
/// <summary>
|
||||
/// InternalMouseLeave
|
||||
/// </summary>
|
||||
public override void InternalMouseLeave()
|
||||
{
|
||||
base.InternalMouseLeave();
|
||||
|
||||
_IsMouseOver = false;
|
||||
|
||||
if (_HotItem != null)
|
||||
{
|
||||
_HotItem.InternalMouseLeave();
|
||||
|
||||
_HotItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InternalMouseMove
|
||||
|
||||
/// <summary>
|
||||
/// InternalMouseMove
|
||||
/// </summary>
|
||||
/// <param name="objArg"></param>
|
||||
public override void InternalMouseMove(MouseEventArgs objArg)
|
||||
{
|
||||
base.InternalMouseMove(objArg);
|
||||
|
||||
_HotItem = GetBoxItemFromPoint(objArg.Location);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InternalMouseDown
|
||||
|
||||
/// <summary>
|
||||
/// InternalMouseDown
|
||||
/// </summary>
|
||||
/// <param name="objArg"></param>
|
||||
public override void InternalMouseDown(MouseEventArgs objArg)
|
||||
{
|
||||
base.InternalMouseDown(objArg);
|
||||
|
||||
_IsMouseDown = true;
|
||||
_MouseDownItem = _HotItem;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InternalMouseUp
|
||||
|
||||
/// <summary>
|
||||
/// InternalMouseUp
|
||||
/// </summary>
|
||||
/// <param name="objArg"></param>
|
||||
public override void InternalMouseUp(MouseEventArgs objArg)
|
||||
{
|
||||
base.InternalMouseUp(objArg);
|
||||
|
||||
_IsMouseDown = false;
|
||||
|
||||
if (_MouseDownItem != null)
|
||||
{
|
||||
if (_MouseDownItem != _HotItem)
|
||||
_MouseDownItem.InternalMouseUp(objArg);
|
||||
|
||||
_MouseDownItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetBoxItemFromPoint
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ControlBoxItem from the given Point
|
||||
/// </summary>
|
||||
/// <param name="pt"></param>
|
||||
/// <returns></returns>
|
||||
private BaseItem GetBoxItemFromPoint(Point pt)
|
||||
{
|
||||
foreach (BaseItem item in SubItems)
|
||||
{
|
||||
if (item.Visible == true)
|
||||
{
|
||||
if (item.Bounds.Contains(pt))
|
||||
return (item);
|
||||
}
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnItemAdded
|
||||
|
||||
/// <summary>
|
||||
/// OnItemAdded
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
protected internal override void OnItemAdded(BaseItem item)
|
||||
{
|
||||
base.OnItemAdded(item);
|
||||
|
||||
MyRefresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnAfterItemRemoved
|
||||
|
||||
/// <summary>
|
||||
/// OnAfterItemRemoved
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
protected internal override void OnAfterItemRemoved(BaseItem item, int itemIndex)
|
||||
{
|
||||
base.OnAfterItemRemoved(item, itemIndex);
|
||||
|
||||
MyRefresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RemoveUserItems
|
||||
|
||||
/// <summary>
|
||||
/// Removes all user added items from the ControlBox
|
||||
/// </summary>
|
||||
public void RemoveUserItems()
|
||||
{
|
||||
for (int i = SubItems.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (SubItems[i] != _MenuBox && SubItems[i] != _CloseBox)
|
||||
SubItems._RemoveAt(i);
|
||||
}
|
||||
|
||||
MyRefresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy object support
|
||||
|
||||
/// <summary>
|
||||
/// Returns copy of the item.
|
||||
/// </summary>
|
||||
public override BaseItem Copy()
|
||||
{
|
||||
SuperTabControlBox objCopy = new SuperTabControlBox(_TabStripItem);
|
||||
CopyToItem(objCopy);
|
||||
|
||||
return (objCopy);
|
||||
}
|
||||
|
||||
protected override void CopyToItem(BaseItem copy)
|
||||
{
|
||||
SuperTabControlBox objCopy = copy as SuperTabControlBox;
|
||||
base.CopyToItem(objCopy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,805 @@
|
||||
#if FRAMEWORK20
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
public class SuperTabMenuBox : PopupItem
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private SuperTabControlBox _ControlBox;
|
||||
|
||||
private Size _ItemSize = new Size(16, 16);
|
||||
|
||||
private bool _IsMouseOver;
|
||||
private bool _IsMouseDown;
|
||||
|
||||
private bool _AutoHide;
|
||||
private bool _ShowTabsOnly = true;
|
||||
private bool _ShowImages = true;
|
||||
private bool _RaiseClickOnSelection;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="controlBox">Associated SuperTabControlBox</param>
|
||||
public SuperTabMenuBox(SuperTabControlBox controlBox)
|
||||
{
|
||||
_ControlBox = controlBox;
|
||||
|
||||
Style = eDotNetBarStyle.Office2007;
|
||||
}
|
||||
|
||||
#region Public override designer hiding
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool BeginGroup
|
||||
{
|
||||
get { return base.BeginGroup; }
|
||||
set { base.BeginGroup = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool AutoCollapseOnClick
|
||||
{
|
||||
get { return base.AutoCollapseOnClick; }
|
||||
set { base.AutoCollapseOnClick = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool CanCustomize
|
||||
{
|
||||
get { return base.CanCustomize; }
|
||||
set { base.CanCustomize = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string Category
|
||||
{
|
||||
get { return base.Category; }
|
||||
set { base.Category = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool ClickAutoRepeat
|
||||
{
|
||||
get { return base.ClickAutoRepeat; }
|
||||
set { base.ClickAutoRepeat = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override int ClickRepeatInterval
|
||||
{
|
||||
get { return base.ClickRepeatInterval; }
|
||||
set { base.ClickRepeatInterval = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override Cursor Cursor
|
||||
{
|
||||
get { return base.Cursor; }
|
||||
set { base.Cursor = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool Enabled
|
||||
{
|
||||
get { return base.Enabled; }
|
||||
set { base.Enabled = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool Stretch
|
||||
{
|
||||
get { return base.Stretch; }
|
||||
set { base.Stretch = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string Text
|
||||
{
|
||||
get { return base.Text; }
|
||||
set { base.Text = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool ThemeAware
|
||||
{
|
||||
get { return base.ThemeAware; }
|
||||
set { base.ThemeAware = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string Tooltip
|
||||
{
|
||||
get { return base.Tooltip; }
|
||||
set { base.Tooltip = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override eItemAlignment ItemAlignment
|
||||
{
|
||||
get { return base.ItemAlignment; }
|
||||
set { base.ItemAlignment = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string KeyTips
|
||||
{
|
||||
get { return base.KeyTips; }
|
||||
set { base.KeyTips = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override ShortcutsCollection Shortcuts
|
||||
{
|
||||
get { return base.Shortcuts; }
|
||||
set { base.Shortcuts = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string Description
|
||||
{
|
||||
get { return base.Description; }
|
||||
set { base.Description = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool GlobalItem
|
||||
{
|
||||
get { return base.GlobalItem; }
|
||||
set { base.GlobalItem = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override bool ShowSubItems
|
||||
{
|
||||
get { return base.ShowSubItems; }
|
||||
set { base.ShowSubItems = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override string GlobalName
|
||||
{
|
||||
get { return base.GlobalName; }
|
||||
set { base.GlobalName = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override Command Command
|
||||
{
|
||||
get { return base.Command; }
|
||||
set { base.Command = value; }
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public override object CommandParameter
|
||||
{
|
||||
get { return base.CommandParameter; }
|
||||
set { base.CommandParameter = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region AutoHide
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the MenuBox is automatically hidden when the tab items size does not exceed the size of the control
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(false), Category("Behavior")]
|
||||
[Description("Indicates whether the MenuBox is automatically hidden when the tab items size does not exceed the size of the control.")]
|
||||
public bool AutoHide
|
||||
{
|
||||
get { return (_AutoHide); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_AutoHide != value)
|
||||
{
|
||||
_AutoHide = value;
|
||||
|
||||
Visible = (value == true) ? AllItemsVisible() == false : true;
|
||||
|
||||
MyRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RaiseClickOnSelection
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the MenuBox raises a ClickEvent when selected
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(false), Category("Behavior")]
|
||||
[Description("Indicates whether the MenuBox raises a ClickEvent when selected.")]
|
||||
public bool RaiseClickOnSelection
|
||||
{
|
||||
get { return (_RaiseClickOnSelection); }
|
||||
set { _RaiseClickOnSelection = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ShowTabsOnly
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether MenuBox shows only Tabs entries
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(true), Category("Behavior")]
|
||||
[Description("Indicates whether MenuBox shows only Tabs entries.")]
|
||||
public bool ShowTabsOnly
|
||||
{
|
||||
get { return (_ShowTabsOnly); }
|
||||
set { _ShowTabsOnly = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ShowImages
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the MenuBox displays each menu entry with its associated Image/Icon
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(true), Category("Behavior")]
|
||||
[Description("Indicates whether the MenuBox displays each menu entry with its associated Image/Icon.")]
|
||||
public bool ShowImages
|
||||
{
|
||||
get { return (_ShowImages); }
|
||||
set { _ShowImages = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Visible
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets MenuBox Visible state
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(true), Category("Behavior")]
|
||||
[Description("Indicates MenuBox Visible state.")]
|
||||
public override bool Visible
|
||||
{
|
||||
get { return base.Visible; }
|
||||
|
||||
set
|
||||
{
|
||||
if (base.Visible != value)
|
||||
{
|
||||
base.Visible = value;
|
||||
|
||||
MyRefresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region IsMouseDown
|
||||
|
||||
/// <summary>
|
||||
/// Gets the MouseDown state
|
||||
/// </summary>
|
||||
internal bool IsMouseDown
|
||||
{
|
||||
get { return (_IsMouseDown); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsMouseOver
|
||||
|
||||
/// <summary>
|
||||
/// Gets the MouseOver state
|
||||
/// </summary>
|
||||
internal bool IsMouseOver
|
||||
{
|
||||
get { return (_IsMouseOver); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region RecalcSize
|
||||
|
||||
/// <summary>
|
||||
/// RecalcSize
|
||||
/// </summary>
|
||||
public override void RecalcSize()
|
||||
{
|
||||
base.RecalcSize();
|
||||
|
||||
WidthInternal = Dpi.Width(_ItemSize.Width);
|
||||
HeightInternal = Dpi.Height(_ItemSize.Height);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MyRefresh
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes the display
|
||||
/// </summary>
|
||||
private void MyRefresh()
|
||||
{
|
||||
if (_ControlBox.TabDisplay != null)
|
||||
{
|
||||
SuperTabStripItem tsi = _ControlBox.TabDisplay.TabStripItem;
|
||||
|
||||
if (tsi != null)
|
||||
{
|
||||
_ControlBox.NeedRecalcSize = true;
|
||||
_ControlBox.RecalcSize();
|
||||
|
||||
tsi.NeedRecalcSize = true;
|
||||
tsi.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Paint
|
||||
|
||||
/// <summary>
|
||||
/// Paint processing
|
||||
/// </summary>
|
||||
/// <param name="p"></param>
|
||||
public override void Paint(ItemPaintArgs p)
|
||||
{
|
||||
Graphics g = p.Graphics;
|
||||
|
||||
using (SuperTabColorTable sct = _ControlBox.TabDisplay.GetColorTable())
|
||||
{
|
||||
Color imageColor = sct.ControlBoxDefault.Image;
|
||||
|
||||
if (IsMouseOver == true)
|
||||
{
|
||||
Rectangle r = Bounds;
|
||||
|
||||
r.Width--;
|
||||
r.Height--;
|
||||
|
||||
imageColor = sct.ControlBoxMouseOver.Image;
|
||||
|
||||
using (Brush br = new SolidBrush(sct.ControlBoxMouseOver.Background))
|
||||
g.FillRectangle(br, r);
|
||||
|
||||
using (Pen pen = new Pen(sct.ControlBoxMouseOver.Border))
|
||||
g.DrawRectangle(pen, r);
|
||||
}
|
||||
|
||||
if (AllItemsVisible() == true)
|
||||
g.DrawImageUnscaled(GetMenuButton1(g, imageColor), Bounds);
|
||||
else
|
||||
g.DrawImageUnscaled(GetMenuButton2(g, imageColor), Bounds);
|
||||
}
|
||||
}
|
||||
|
||||
#region AllItemsVisible
|
||||
|
||||
/// <summary>
|
||||
/// Determines if all the items are visible
|
||||
/// </summary>
|
||||
/// <returns>true if all visible</returns>
|
||||
private bool AllItemsVisible()
|
||||
{
|
||||
SubItemsCollection tabs = _ControlBox.TabDisplay.Tabs;
|
||||
|
||||
for (int i = 0; i < tabs.Count; i++)
|
||||
{
|
||||
if (tabs[i].Visible == true && tabs[i].Displayed == false)
|
||||
return (false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetMenuButton1
|
||||
|
||||
/// <summary>
|
||||
/// Gets MenuButton1
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
/// <param name="color"></param>
|
||||
/// <returns></returns>
|
||||
private Bitmap GetMenuButton1(Graphics g, Color color)
|
||||
{
|
||||
return (_ControlBox.TabDisplay.GetMenuButton1(g, color));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetMenuButton2
|
||||
|
||||
/// <summary>
|
||||
/// Gets MenuButton2
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
/// <param name="color"></param>
|
||||
/// <returns></returns>
|
||||
private Bitmap GetMenuButton2(Graphics g, Color color)
|
||||
{
|
||||
return (_ControlBox.TabDisplay.GetMenuButton2(g, color));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mouse support
|
||||
|
||||
#region InternalMouseEnter
|
||||
|
||||
/// <summary>
|
||||
/// InternalMouseEnter
|
||||
/// </summary>
|
||||
public override void InternalMouseEnter()
|
||||
{
|
||||
base.InternalMouseEnter();
|
||||
|
||||
_IsMouseOver = true;
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InternalMouseLeave
|
||||
|
||||
/// <summary>
|
||||
/// InternalMouseLeave
|
||||
/// </summary>
|
||||
public override void InternalMouseLeave()
|
||||
{
|
||||
base.InternalMouseLeave();
|
||||
|
||||
_IsMouseOver = false;
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InternalMouseDown
|
||||
|
||||
/// <summary>
|
||||
/// InternalMouseDown
|
||||
/// </summary>
|
||||
/// <param name="objArg"></param>
|
||||
public override void InternalMouseDown(MouseEventArgs objArg)
|
||||
{
|
||||
_IsMouseDown = true;
|
||||
|
||||
if (DesignMode == false && objArg.Button == MouseButtons.Left)
|
||||
{
|
||||
LoadTabMenu();
|
||||
|
||||
Point pt = GetPopupPosition();
|
||||
|
||||
Popup(pt);
|
||||
}
|
||||
}
|
||||
|
||||
#region GetPopupPosition
|
||||
|
||||
/// <summary>
|
||||
/// Gets the popup menu position
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private Point GetPopupPosition()
|
||||
{
|
||||
Point pt = new Point(Bounds.X, Bounds.Bottom);
|
||||
|
||||
Control c = (Control)_ControlBox.GetContainerControl(true);
|
||||
|
||||
if (c != null)
|
||||
pt = c.PointToScreen(pt);
|
||||
|
||||
return (pt);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LoadTabMenu
|
||||
|
||||
/// <summary>
|
||||
/// Loads the TabMenu
|
||||
/// </summary>
|
||||
private void LoadTabMenu()
|
||||
{
|
||||
SubItems.Clear();
|
||||
|
||||
SubItemsCollection tabs = _ControlBox.TabDisplay.Tabs;
|
||||
|
||||
if (_ShowTabsOnly == true)
|
||||
LoadTabsMenu(tabs);
|
||||
else
|
||||
LoadItemsMenu(tabs);
|
||||
}
|
||||
|
||||
#region LoadTabsMenu
|
||||
|
||||
/// <summary>
|
||||
/// Loads Tabs only into the TabMenu
|
||||
/// </summary>
|
||||
/// <param name="tabs"></param>
|
||||
private void LoadTabsMenu(SubItemsCollection tabs)
|
||||
{
|
||||
for (int i = 0; i < tabs.Count; i++)
|
||||
{
|
||||
SuperTabItem tab = tabs[i] as SuperTabItem;
|
||||
|
||||
if (tab != null && tab.Visible == true)
|
||||
{
|
||||
ButtonItem bi = new ButtonItem();
|
||||
|
||||
bi.Tag = tab;
|
||||
bi.Text = tab.Text;
|
||||
|
||||
if (tab.Enabled == true)
|
||||
bi.Click += SuperTabMenuBoxClick;
|
||||
else
|
||||
bi.Enabled = false;
|
||||
|
||||
SubItems.Add(bi);
|
||||
|
||||
if (_ShowImages == true)
|
||||
SetMenuImage(bi, tab);
|
||||
|
||||
if (tab.IsSelected == true)
|
||||
bi.Checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LoadItemsMenu
|
||||
|
||||
/// <summary>
|
||||
/// Loads all items into the TabMenu
|
||||
/// </summary>
|
||||
/// <param name="tabs"></param>
|
||||
private void LoadItemsMenu(SubItemsCollection tabs)
|
||||
{
|
||||
ButtonItem[] items = new ButtonItem[tabs.Count];
|
||||
|
||||
for (int i = 0; i < tabs.Count; i++)
|
||||
{
|
||||
if (tabs[i].Visible == true)
|
||||
{
|
||||
items[i] = new ButtonItem();
|
||||
|
||||
items[i].Tag = tabs[i];
|
||||
items[i].Text = tabs[i].Text;
|
||||
|
||||
if (tabs[i].Enabled == true)
|
||||
items[i].Click += SuperTabMenuBoxClick;
|
||||
else
|
||||
items[i].Enabled = false;
|
||||
|
||||
if (_ShowImages == true)
|
||||
{
|
||||
if (tabs[i] is SuperTabItem)
|
||||
SetMenuImage(items[i], ((SuperTabItem) tabs[i]).GetTabImage());
|
||||
|
||||
else if (tabs[i] is ButtonItem)
|
||||
SetMenuImage(items[i], ((ButtonItem) tabs[i]).GetImage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int index = _ControlBox.TabDisplay.TabStripItem.SelectedTabIndex;
|
||||
|
||||
if (index >= 0 && index < tabs.Count)
|
||||
items[index].Checked = true;
|
||||
|
||||
SubItems.AddRange(items);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetMenuImage
|
||||
|
||||
/// <summary>
|
||||
/// Sets the TabMenu entry image
|
||||
/// </summary>
|
||||
/// <param name="bi"></param>
|
||||
/// <param name="image"></param>
|
||||
private void SetMenuImage(ButtonItem bi, SuperTabItem tab)
|
||||
{
|
||||
if (string.IsNullOrEmpty(tab.SymbolRealized) == false)
|
||||
{
|
||||
bi.Symbol = tab.Symbol;
|
||||
bi.SymbolSize = tab.SymbolSize;
|
||||
bi.SymbolColor = tab.TabItemDisplay.GetSymbolColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetMenuImage(bi, tab.GetTabImage());
|
||||
}
|
||||
}
|
||||
|
||||
private void SetMenuImage(ButtonItem bi, CompositeImage image)
|
||||
{
|
||||
if (image != null)
|
||||
{
|
||||
if (image.Icon != null)
|
||||
bi.Icon = image.Icon;
|
||||
|
||||
else if (image.Image != null)
|
||||
{
|
||||
if (ImageAnimator.CanAnimate(image.Image) == true)
|
||||
{
|
||||
FrameDimension frameDimensions =
|
||||
new FrameDimension(image.Image.FrameDimensionsList[0]);
|
||||
|
||||
image.Image.SelectActiveFrame(frameDimensions, 0);
|
||||
|
||||
bi.Image = new Bitmap(image.Image);
|
||||
bi.NeedRecalcSize = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bi.Image = image.Image;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region SuperTabMenuBox_Click
|
||||
|
||||
/// <summary>
|
||||
/// Handles SuperTabMenuBox_Click event
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void SuperTabMenuBoxClick(object sender, EventArgs e)
|
||||
{
|
||||
ButtonItem bi = sender as ButtonItem;
|
||||
|
||||
if (bi != null)
|
||||
{
|
||||
BaseItem item = bi.Tag as BaseItem;
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
SuperTabItem tab = bi.Tag as SuperTabItem;
|
||||
|
||||
if (tab != null)
|
||||
_ControlBox.TabDisplay.TabStripItem.SelectedTab = tab;
|
||||
else
|
||||
_ControlBox.TabDisplay.TabStripItem.VisibleTab = item;
|
||||
|
||||
if (_RaiseClickOnSelection == true)
|
||||
item.RaiseClick(eEventSource.Code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InternalMouseUp
|
||||
|
||||
/// <summary>
|
||||
/// InternalMouseUp
|
||||
/// </summary>
|
||||
/// <param name="objArg"></param>
|
||||
public override void InternalMouseUp(MouseEventArgs objArg)
|
||||
{
|
||||
base.InternalMouseUp(objArg);
|
||||
|
||||
_IsMouseDown = false;
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy object support
|
||||
|
||||
/// <summary>
|
||||
/// Returns copy of the item.
|
||||
/// </summary>
|
||||
public override BaseItem Copy()
|
||||
{
|
||||
SuperTabMenuBox objCopy = new SuperTabMenuBox(_ControlBox);
|
||||
CopyToItem(objCopy);
|
||||
|
||||
return (objCopy);
|
||||
}
|
||||
|
||||
protected override void CopyToItem(BaseItem copy)
|
||||
{
|
||||
SuperTabMenuBox objCopy = copy as SuperTabMenuBox;
|
||||
base.CopyToItem(objCopy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region enums
|
||||
|
||||
#region TabMenuOpenEventArgs
|
||||
|
||||
public class TabMenuOpenEventArgs : CancelEventArgs
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private ButtonItem _TabMenu;
|
||||
|
||||
#endregion
|
||||
|
||||
public TabMenuOpenEventArgs(ButtonItem tabMenu)
|
||||
{
|
||||
_TabMenu = tabMenu;
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
public ButtonItem TabMenu
|
||||
{
|
||||
get { return (_TabMenu); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TabMenuCloseEventArgs
|
||||
|
||||
public class TabMenuCloseEventArgs : EventArgs
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private ButtonItem _TabMenu;
|
||||
|
||||
#endregion
|
||||
|
||||
public TabMenuCloseEventArgs(ButtonItem tabMenu)
|
||||
{
|
||||
_TabMenu = tabMenu;
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
public ButtonItem TabMenu
|
||||
{
|
||||
get { return (_TabMenu); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
50
PROMS/DotNetBar Source Code/SuperTabControl/SuperTabStrip/SuperTabDragWindow.Designer.cs
generated
Normal file
50
PROMS/DotNetBar Source Code/SuperTabControl/SuperTabStrip/SuperTabDragWindow.Designer.cs
generated
Normal file
@@ -0,0 +1,50 @@
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
partial class SuperTabDragWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// SuperTabDragWindow
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.CausesValidation = false;
|
||||
this.ClientSize = new System.Drawing.Size(63, 24);
|
||||
this.DoubleBuffered = true;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "SuperTabDragWindow";
|
||||
this.Opacity = 0.7;
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
#if FRAMEWORK20
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
public partial class SuperTabDragWindow : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public SuperTabDragWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ShowWithoutActivation
|
||||
/// </summary>
|
||||
protected override bool ShowWithoutActivation
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,256 @@
|
||||
#if FRAMEWORK20
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
public class VS2008DockSuperTabItem : SuperTabItemBaseDisplay
|
||||
{
|
||||
public VS2008DockSuperTabItem(SuperTabItem tabItem)
|
||||
: base(tabItem)
|
||||
{
|
||||
}
|
||||
|
||||
#region TabItemPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the tab item GraphicsPath
|
||||
/// </summary>
|
||||
/// <returns>Tab path</returns>
|
||||
internal override GraphicsPath TabItemPath()
|
||||
{
|
||||
// Check to see if the user is supplying a path
|
||||
|
||||
GraphicsPath path = base.TabItemPath();
|
||||
|
||||
if (path != null)
|
||||
return (path);
|
||||
|
||||
// Supply the default path based upon
|
||||
// the current tab alignment
|
||||
|
||||
switch (TabItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Top:
|
||||
return (TopTabPath());
|
||||
|
||||
case eTabStripAlignment.Bottom:
|
||||
return (BottomTabPath());
|
||||
|
||||
case eTabStripAlignment.Left:
|
||||
return (LeftTabPath());
|
||||
|
||||
default:
|
||||
return (RightTabPath());
|
||||
}
|
||||
}
|
||||
|
||||
#region TopTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Create the Top tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath TopTabPath()
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
r.Height += 2;
|
||||
|
||||
// Create the path
|
||||
|
||||
path.AddLines(new Point[]
|
||||
{
|
||||
new Point(r.X, r.Bottom),
|
||||
new Point(r.X, r.Top),
|
||||
new Point(r.Right, r.Top),
|
||||
new Point(r.Right, r.Bottom),
|
||||
});
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BottomTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the Bottom tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath BottomTabPath()
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
{
|
||||
r.Y -= 2;
|
||||
r.Height += 2;
|
||||
}
|
||||
|
||||
// Create the path
|
||||
|
||||
path.AddLines(new Point[]
|
||||
{
|
||||
new Point(r.Right, r.Top),
|
||||
new Point(r.Right, r.Bottom),
|
||||
new Point(r.X, r.Bottom),
|
||||
new Point(r.X, r.Top),
|
||||
});
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LeftTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the Left tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath LeftTabPath()
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
r.Width += 2;
|
||||
|
||||
// Create the tab path
|
||||
|
||||
path.AddLines(new Point[]
|
||||
{
|
||||
new Point(r.Right, r.Bottom),
|
||||
new Point(r.X, r.Bottom),
|
||||
new Point(r.X, r.Top),
|
||||
new Point(r.Right, r.Top),
|
||||
});
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RightTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Create the Right tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath RightTabPath()
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
{
|
||||
r.X -= 2;
|
||||
r.Width += 2;
|
||||
}
|
||||
|
||||
// Create the tab path
|
||||
|
||||
path.AddLines(new Point[]
|
||||
{
|
||||
new Point(r.X, r.Top),
|
||||
new Point(r.Right, r.Top),
|
||||
new Point(r.Right, r.Bottom),
|
||||
new Point(r.X, r.Bottom),
|
||||
});
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyPredefinedColor
|
||||
|
||||
/// <summary>
|
||||
/// Applies the predefined tab color to the color table
|
||||
/// </summary>
|
||||
/// <param name="tabState"></param>
|
||||
/// <param name="sct"></param>
|
||||
internal override void ApplyPredefinedColor(eTabState tabState, SuperTabItemStateColorTable sct)
|
||||
{
|
||||
if (TabItem.PredefinedColor != eTabItemColor.Default)
|
||||
{
|
||||
SuperTabItemColorTable ct =
|
||||
SuperTabStyleColorFactory.GetPredefinedTabColors(TabItem.PredefinedColor, ColorFactory.Empty);
|
||||
|
||||
SuperTabItemStateColorTable ict = ct.Default.Normal;
|
||||
|
||||
switch (tabState)
|
||||
{
|
||||
case eTabState.SelectedMouseOver:
|
||||
ict = ct.Default.SelectedMouseOver;
|
||||
break;
|
||||
|
||||
case eTabState.MouseOver:
|
||||
ict = ct.Default.MouseOver;
|
||||
break;
|
||||
|
||||
case eTabState.Selected:
|
||||
ict = ct.Default.Selected;
|
||||
ict.InnerBorder = Color.Empty;
|
||||
break;
|
||||
}
|
||||
|
||||
sct.InnerBorder = ict.InnerBorder;
|
||||
sct.OuterBorder = ict.OuterBorder;
|
||||
sct.Background = ict.Background;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyPredefinedColor
|
||||
|
||||
/// <summary>
|
||||
/// Applies the predefined color to the panel color table
|
||||
/// </summary>
|
||||
/// <param name="pct"></param>
|
||||
internal override void ApplyPredefinedColor(SuperTabPanelItemColorTable pct)
|
||||
{
|
||||
if (TabItem.PredefinedColor != eTabItemColor.Default)
|
||||
{
|
||||
SuperTabPanelItemColorTable ct =
|
||||
SuperTabStyleColorFactory.GetPredefinedPanelColors(TabItem.PredefinedColor, ColorFactory.Empty);
|
||||
|
||||
pct.Background = ct.Background;
|
||||
pct.InnerBorder = pct.Background.Colors[pct.Background.Colors.Length - 1];
|
||||
pct.OuterBorder = ct.OuterBorder;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,30 @@
|
||||
#if FRAMEWORK20
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
internal class VS2008DockSuperTabStrip : SuperTabStripBaseDisplay
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="tabStripItem">Associated SuperTabStripItem</param>
|
||||
public VS2008DockSuperTabStrip(SuperTabStripItem tabStripItem)
|
||||
: base(tabStripItem)
|
||||
{
|
||||
}
|
||||
|
||||
#region Internal properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the TabLayoutOffset
|
||||
/// </summary>
|
||||
internal override Size TabLayoutOffset
|
||||
{
|
||||
get { return (new Size(3, 2)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,251 @@
|
||||
#if FRAMEWORK20
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
public class VS2008DocumentSuperTabItem : SuperTabItemBaseDisplay
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int SmRadius = 8;
|
||||
private const int LgRadius = 20;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="tabItem">Associated SuperTabItem</param>
|
||||
public VS2008DocumentSuperTabItem(SuperTabItem tabItem)
|
||||
: base(tabItem)
|
||||
{
|
||||
}
|
||||
|
||||
#region ContentRectangle
|
||||
|
||||
/// <summary>
|
||||
/// Returns the tab ContentRectangle
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal override Rectangle ContentRectangle()
|
||||
{
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
|
||||
int n = TabStripItem.TabDisplay.TabOverlap;
|
||||
|
||||
if (TabStripItem.IsVertical == true)
|
||||
{
|
||||
r.Y += n;
|
||||
r.Height -= n;
|
||||
}
|
||||
else
|
||||
{
|
||||
r.X += n;
|
||||
r.Width -= n;
|
||||
}
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TabItemPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the tab item GraphicsPath
|
||||
/// </summary>
|
||||
/// <returns>Tab path</returns>
|
||||
internal override GraphicsPath TabItemPath()
|
||||
{
|
||||
// Check to see if the user is supplying a path
|
||||
|
||||
GraphicsPath path = base.TabItemPath();
|
||||
|
||||
if (path != null)
|
||||
return (path);
|
||||
|
||||
// Supply the default path based upon
|
||||
// the current tab alignment
|
||||
|
||||
switch (TabItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Top:
|
||||
return (TopTabPath());
|
||||
|
||||
case eTabStripAlignment.Bottom:
|
||||
return (BottomTabPath());
|
||||
|
||||
case eTabStripAlignment.Left:
|
||||
return (LeftTabPath());
|
||||
|
||||
default:
|
||||
return (RightTabPath());
|
||||
}
|
||||
}
|
||||
|
||||
#region TopTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Create the Top tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath TopTabPath()
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
r.Height += 2;
|
||||
|
||||
// Create the path
|
||||
|
||||
int n = TabStripItem.TabDisplay.TabOverlap + TabStripItem.TabDisplay.TabSpacing;
|
||||
|
||||
Rectangle ar = new Rectangle(r.X + n, r.Y, LgRadius, LgRadius);
|
||||
|
||||
path.AddLine(r.X, r.Bottom, r.X, r.Bottom);
|
||||
path.AddArc(ar, 218, 52);
|
||||
|
||||
ar = new Rectangle(r.Right - SmRadius, r.Y, SmRadius, SmRadius);
|
||||
path.AddArc(ar, 270, 90);
|
||||
|
||||
path.AddLine(r.Right, r.Top + SmRadius, r.Right, r.Bottom);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BottomTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the Bottom tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath BottomTabPath()
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
{
|
||||
r.Y -= 2;
|
||||
r.Height += 2;
|
||||
}
|
||||
|
||||
// Create the path
|
||||
|
||||
int n = TabStripItem.TabDisplay.TabOverlap;
|
||||
|
||||
Rectangle ar = new
|
||||
Rectangle(r.Right - SmRadius, r.Bottom - SmRadius, SmRadius, SmRadius);
|
||||
|
||||
path.AddLine(r.Right, r.Top, r.Right, r.Bottom - SmRadius);
|
||||
path.AddArc(ar, 0, 90);
|
||||
|
||||
ar = new Rectangle(r.X + n, r.Bottom - LgRadius, LgRadius, LgRadius);
|
||||
path.AddArc(ar, 90, 62);
|
||||
|
||||
path.AddLine(r.X, r.Top, r.X, r.Top);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LeftTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the Left tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath LeftTabPath()
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
r.Width += 2;
|
||||
|
||||
// Create the tab path
|
||||
|
||||
int n = TabStripItem.TabDisplay.TabOverlap;
|
||||
|
||||
Rectangle ar = new
|
||||
Rectangle(r.X, r.Bottom - SmRadius, SmRadius, SmRadius);
|
||||
|
||||
path.AddLine(r.Right, r.Bottom, r.X + SmRadius, r.Bottom);
|
||||
path.AddArc(ar, 90, 90);
|
||||
|
||||
ar = new Rectangle(r.X, r.Y + n, LgRadius, LgRadius);
|
||||
path.AddArc(ar, 180, 62);
|
||||
|
||||
path.AddLine(r.Right, r.Top, r.Right, r.Top);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RightTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Create the Right tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath RightTabPath()
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
{
|
||||
r.X -= 2;
|
||||
r.Width += 2;
|
||||
}
|
||||
|
||||
// Create the tab path
|
||||
|
||||
int n = TabStripItem.TabDisplay.TabOverlap;
|
||||
|
||||
Rectangle ar = new
|
||||
Rectangle(r.Right - LgRadius, r.Top + n, LgRadius, LgRadius);
|
||||
|
||||
path.AddLine(r.X, r.Top, r.X, r.Top);
|
||||
path.AddArc(ar, 360 - 62, 62);
|
||||
|
||||
ar = new Rectangle(r.Right - SmRadius, r.Bottom - SmRadius, SmRadius, SmRadius);
|
||||
path.AddArc(ar, 0, 90);
|
||||
|
||||
path.AddLine(r.Right - SmRadius, r.Bottom, r.X, r.Bottom);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,157 @@
|
||||
#if FRAMEWORK20
|
||||
using System.Drawing;
|
||||
using DevComponents.UI.ContentManager;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
internal class VS2008DocumentSuperTabStrip : SuperTabStripBaseDisplay
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int HvTabSpacing = 0;
|
||||
private const int HvTabOverLap = 20;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="tabStripItem">Associated SuperTabStripItem</param>
|
||||
public VS2008DocumentSuperTabStrip(SuperTabStripItem tabStripItem)
|
||||
: base(tabStripItem)
|
||||
{
|
||||
}
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region TabOverlap
|
||||
|
||||
/// <summary>
|
||||
/// Gets the TabOverlap
|
||||
/// </summary>
|
||||
internal override int TabOverlap
|
||||
{
|
||||
get { return (HvTabOverLap); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TabSpacing
|
||||
|
||||
/// <summary>
|
||||
/// Gets the TabSpacing
|
||||
/// </summary>
|
||||
internal override int TabSpacing
|
||||
{
|
||||
get { return (HvTabSpacing); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TabOverlapLeft
|
||||
|
||||
/// <summary>
|
||||
/// Gets the TabOverlapLeft
|
||||
/// </summary>
|
||||
internal override bool TabOverlapLeft
|
||||
{
|
||||
get { return (true); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TabLayoutOffset
|
||||
|
||||
/// <summary>
|
||||
/// Gets the TabLayoutOffset
|
||||
/// </summary>
|
||||
internal override Size TabLayoutOffset
|
||||
{
|
||||
get { return (new Size(3, 2)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MinTabSize
|
||||
|
||||
/// <summary>
|
||||
/// Gets the MinTabSize
|
||||
/// </summary>
|
||||
internal override Size MinTabSize
|
||||
{
|
||||
get
|
||||
{
|
||||
if (TabStripItem.IsVertical == true && TabStripItem.HorizontalText == true)
|
||||
return (new Size(33, 35));
|
||||
|
||||
return (new Size(33, 16));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region NextBlockPosition (LayoutManager)
|
||||
|
||||
/// <summary>
|
||||
/// Gets the LayoutManager NextBlockPosition
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void NextBlockPosition(LayoutManagerPositionEventArgs e)
|
||||
{
|
||||
int n = Tabs.IndexOf((BaseItem)e.Block);
|
||||
|
||||
if (n >= 0 && n + 1 < Tabs.Count)
|
||||
{
|
||||
SuperTabItem tab1 = Tabs[n] as SuperTabItem;
|
||||
|
||||
if (tab1 != null)
|
||||
{
|
||||
SuperTabItem tab2 = Tabs[n + 1] as SuperTabItem;
|
||||
|
||||
if (tab2 != null)
|
||||
{
|
||||
e.NextPosition = e.CurrentPosition;
|
||||
|
||||
if (TabStripItem.IsVertical == true)
|
||||
e.NextPosition.Y += (e.Block.Bounds.Height - HvTabOverLap);
|
||||
else
|
||||
e.NextPosition.X += (e.Block.Bounds.Width - HvTabOverLap);
|
||||
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region NextBlockPosition (PromoteSelectedTab)
|
||||
|
||||
/// <summary>
|
||||
/// Gets the PromoteSelectedTab NextBlockPosition
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="vItem"></param>
|
||||
/// <returns></returns>
|
||||
internal override Rectangle NextBlockPosition(BaseItem item, BaseItem vItem)
|
||||
{
|
||||
Rectangle r = base.NextBlockPosition(item, vItem);
|
||||
|
||||
if (item is SuperTabItem && vItem is SuperTabItem)
|
||||
{
|
||||
if (IsVertical == true)
|
||||
r.Y -= HvTabOverLap;
|
||||
else
|
||||
r.X -= HvTabOverLap;
|
||||
}
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,224 @@
|
||||
#if FRAMEWORK20
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
public class WinMediaPlayer12SuperTabItem : SuperTabItemBaseDisplay
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int Radius = 4;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="tabItem">Associated SuperTabItem</param>
|
||||
public WinMediaPlayer12SuperTabItem(SuperTabItem tabItem)
|
||||
: base(tabItem)
|
||||
{
|
||||
}
|
||||
|
||||
#region TabItemPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the tab item GraphicsPath
|
||||
/// </summary>
|
||||
/// <returns>Tab path</returns>
|
||||
internal override GraphicsPath TabItemPath()
|
||||
{
|
||||
// Check to see if the user is supplying a path
|
||||
|
||||
GraphicsPath path = base.TabItemPath();
|
||||
|
||||
if (path != null)
|
||||
return (path);
|
||||
|
||||
// Supply the default path based upon
|
||||
// the current tab alignment
|
||||
|
||||
switch (TabItem.TabAlignment)
|
||||
{
|
||||
case eTabStripAlignment.Top:
|
||||
return (TopTabPath());
|
||||
|
||||
case eTabStripAlignment.Bottom:
|
||||
return (BottomTabPath());
|
||||
|
||||
case eTabStripAlignment.Left:
|
||||
return (LeftTabPath());
|
||||
|
||||
default:
|
||||
return (RightTabPath());
|
||||
}
|
||||
}
|
||||
|
||||
#region TopTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Create the Top tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath TopTabPath()
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
r.Height += 2;
|
||||
|
||||
// Create the path
|
||||
|
||||
int n = TabStripItem.TabDisplay.TabSpacing;
|
||||
|
||||
Rectangle ar = new Rectangle(r.X, r.Y, Radius, Radius);
|
||||
|
||||
path.AddLine(r.X, r.Bottom, r.X, r.Top + Radius);
|
||||
path.AddArc(ar, 180, 90);
|
||||
|
||||
path.AddLine(r.X + Radius, r.Top, r.Right - n - Radius, r.Top);
|
||||
|
||||
ar.X = r.Right - n - Radius;
|
||||
path.AddArc(ar, 270, 90);
|
||||
|
||||
path.AddLine(r.Right - n, r.Top + Radius, r.Right - n, r.Bottom);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BottomTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the Bottom tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath BottomTabPath()
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
{
|
||||
r.Y -= 2;
|
||||
r.Height += 2;
|
||||
}
|
||||
|
||||
// Create the path
|
||||
|
||||
Rectangle ar = new
|
||||
Rectangle(r.Right - Radius, r.Bottom - Radius, Radius, Radius);
|
||||
|
||||
path.AddLine(r.Right, r.Top, r.Right, r.Bottom - Radius);
|
||||
path.AddArc(ar, 0, 90);
|
||||
|
||||
path.AddLine(r.Right - Radius, r.Bottom, r.X + Radius, r.Bottom);
|
||||
|
||||
ar.X = r.X;
|
||||
path.AddArc(ar, 90, 90);
|
||||
|
||||
path.AddLine(r.X, r.Bottom - Radius, r.X, r.Top);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LeftTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Creates the Left tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath LeftTabPath()
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
r.Width += 2;
|
||||
|
||||
// Create the tab path
|
||||
|
||||
Rectangle ar = new
|
||||
Rectangle(r.X, r.Bottom - Radius, Radius, Radius);
|
||||
|
||||
path.AddLine(r.Right, r.Bottom, r.X + Radius, r.Bottom);
|
||||
path.AddArc(ar, 90, 90);
|
||||
|
||||
path.AddLine(r.X, r.Bottom - Radius, r.X, r.Top + Radius);
|
||||
|
||||
ar.Y = r.Y;
|
||||
path.AddArc(ar, 180, 90);
|
||||
|
||||
path.AddLine(r.X + Radius, r.Top, r.Right, r.Top);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RightTabPath
|
||||
|
||||
/// <summary>
|
||||
/// Create the Right tab path
|
||||
/// </summary>
|
||||
/// <returns>GraphicsPath</returns>
|
||||
private GraphicsPath RightTabPath()
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
||||
Rectangle r = TabItem.DisplayRectangle;
|
||||
r.Width -= 1;
|
||||
r.Height -= 1;
|
||||
|
||||
// Allow for the TabStrip border
|
||||
|
||||
if (TabItem.IsSelected == true)
|
||||
{
|
||||
r.X -= 2;
|
||||
r.Width += 2;
|
||||
}
|
||||
|
||||
// Create the tab path
|
||||
|
||||
Rectangle ar = new
|
||||
Rectangle(r.Right - Radius, r.Top, Radius, Radius);
|
||||
|
||||
path.AddLine(r.X, r.Top, r.Right - Radius, r.Top);
|
||||
path.AddArc(ar, 270, 90);
|
||||
|
||||
path.AddLine(r.Right, r.Top + Radius, r.Right, r.Bottom - Radius);
|
||||
|
||||
ar.Y = r.Bottom - Radius;
|
||||
path.AddArc(ar, 0, 90);
|
||||
|
||||
path.AddLine(r.Right - Radius, r.Bottom, r.X, r.Bottom);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,86 @@
|
||||
#if FRAMEWORK20
|
||||
using System.Drawing;
|
||||
using DevComponents.UI.ContentManager;
|
||||
|
||||
namespace DevComponents.DotNetBar
|
||||
{
|
||||
internal class WinMediaPlayer12SuperTabStrip : SuperTabStripBaseDisplay
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const int HvTabOverLap = -3;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="tabStripItem">Associated SuperTabStripItem</param>
|
||||
public WinMediaPlayer12SuperTabStrip(SuperTabStripItem tabStripItem)
|
||||
: base(tabStripItem)
|
||||
{
|
||||
tabStripItem.ControlBox.MenuBox.Style = eDotNetBarStyle.Office2010;
|
||||
}
|
||||
|
||||
#region NextBlockPosition (LayoutManager)
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Layout manager NextBlockPosition
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void NextBlockPosition(LayoutManagerPositionEventArgs e)
|
||||
{
|
||||
int n = Tabs.IndexOf((BaseItem)e.Block);
|
||||
|
||||
if (n >= 0 && n + 1 < Tabs.Count)
|
||||
{
|
||||
SuperTabItem tab1 = Tabs[n] as SuperTabItem;
|
||||
|
||||
if (tab1 != null)
|
||||
{
|
||||
SuperTabItem tab2 = Tabs[n + 1] as SuperTabItem;
|
||||
|
||||
if (tab2 != null)
|
||||
{
|
||||
e.NextPosition = e.CurrentPosition;
|
||||
|
||||
if (TabStripItem.IsVertical == true)
|
||||
e.NextPosition.Y += (e.Block.Bounds.Height - HvTabOverLap);
|
||||
else
|
||||
e.NextPosition.X += (e.Block.Bounds.Width - HvTabOverLap);
|
||||
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region NextBlockPosition (PromoteSelTab)
|
||||
|
||||
/// <summary>
|
||||
/// Gets the "PromoteSelTab" NextBlockPosition
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="vItem"></param>
|
||||
/// <returns></returns>
|
||||
internal override Rectangle NextBlockPosition(BaseItem item, BaseItem vItem)
|
||||
{
|
||||
Rectangle r = base.NextBlockPosition(item, vItem);
|
||||
|
||||
if (item is SuperTabItem && vItem is SuperTabItem)
|
||||
{
|
||||
if (TabStripItem.IsVertical == true)
|
||||
r.Y -= HvTabOverLap;
|
||||
else
|
||||
r.X -= HvTabOverLap;
|
||||
}
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user