/Other/Netron/Neon/WinFormsUI/NetronExtender/FromBase/DockPaneCaptionFromBase.cs
C# | 392 lines | 323 code | 57 blank | 12 comment | 21 complexity | 08998c0702d510eeae260d027f0fbb5d MD5 | raw file
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- using System.Drawing.Drawing2D;
- using Netron.Neon.WinFormsUI;
- using System.ComponentModel;
- namespace Netron.Neon.WinFormsUI.Netron
- {
- [ToolboxItem(false)]
- public class DockPaneCaptionFromBase : DockPaneCaptionBase
- {
- #region consts
- private const int _TextGapTop = 2;
- private const int _TextGapBottom = 0;
- private const int _TextGapLeft = 3;
- private const int _TextGapRight = 3;
- private const int _ButtonGapTop = 2;
- private const int _ButtonGapBottom = 1;
- private const int _ButtonGapBetween = 1;
- private const int _ButtonGapLeft = 1;
- private const int _ButtonGapRight = 2;
- private const string _ResourceImageCloseEnabled = "DockPaneCaption.CloseEnabled.bmp";
- private const string _ResourceImageCloseDisabled = "DockPaneCaption.CloseDisabled.bmp";
- private const string _ResourceImageAutoHideYes = "DockPaneCaption.AutoHideYes.bmp";
- private const string _ResourceImageAutoHideNo = "DockPaneCaption.AutoHideNo.bmp";
- private const string _ResourceToolTipClose = "DockPaneCaption.ToolTipClose";
- private const string _ResourceToolTipAutoHide = "DockPaneCaption.ToolTipAutoHide";
- #endregion
-
- private InertButton m_buttonClose;
- private InertButton m_buttonAutoHide;
- private InertButton m_buttonWhatIsIt;
- private LinearGradientBrush captionBrush;
- private Color darkColor = ColorMixer.DarkColor;//Color.SlateGray;
- private Color lightColor = Color.Silver;
- public Color DarkColor
- {
- get{return darkColor;}
- set
- {
- darkColor = value;
- SetBrush();
- }
- }
- public Color LightColor
- {
- get{return lightColor;}
- set
- {
- lightColor = value;
- SetBrush();
- }
- }
- public void SetBrush()
- {
-
- if(ClientRectangle==Rectangle.Empty) return;
- captionBrush = new LinearGradientBrush(ClientRectangle, darkColor, lightColor, LinearGradientMode.Horizontal);
- // if(bellShaped)
- // captionBrush.SetSigmaBellShape(bellCenter,bellFalloff);
-
- // darkBrush = new SolidBrush(darkColor);
- // roundingPen = new Pen(darkColor,1);
- // foreBrush = new SolidBrush(this.ForeColor);
- // unselectedForeBrush = new SolidBrush(unselectedForeColor);
- // unselectedEdgePen = new Pen(unselectedEdgeColor,1);
- // unselectedTabBrush = new SolidBrush(UnselectedTabColor);
- Invalidate();
- }
-
- protected internal DockPaneCaptionFromBase(DockPane pane) : base(pane)
- {
-
-
- SuspendLayout();
-
- Font = SystemInformation.MenuFont;
-
- m_buttonClose = new InertButton(ImageCloseEnabled, ImageCloseDisabled);
- m_buttonAutoHide = new InertButton();
-
- m_buttonClose.ToolTipText = ToolTipClose;
-
- m_buttonClose.Anchor = AnchorStyles.Top | AnchorStyles.Right;
- m_buttonClose.Click += new EventHandler(this.Close_Click);
-
- m_buttonAutoHide.ToolTipText = ToolTipAutoHide;
- m_buttonAutoHide.Anchor = AnchorStyles.Top | AnchorStyles.Right;
- m_buttonAutoHide.Click += new EventHandler(AutoHide_Click);
-
- m_buttonWhatIsIt = new InertButton();
- m_buttonWhatIsIt.BackColor = ColorMixer.LightColor;
- m_buttonWhatIsIt.ForeColor = ColorMixer.DarkColor;
- m_buttonWhatIsIt.ToolTipText = "What is this?";
- m_buttonWhatIsIt.Text = "?";
- m_buttonWhatIsIt.Anchor = AnchorStyles.Top | AnchorStyles.Right;
- m_buttonWhatIsIt.Click+=new EventHandler(m_buttonWhatIsIt_Click);
-
-
- Controls.AddRange(new Control[] { m_buttonWhatIsIt, m_buttonClose, m_buttonAutoHide });
-
- ResumeLayout();
- }
-
- #region Customizable Properties
- protected virtual int TextGapTop
- {
- get { return _TextGapTop; }
- }
-
- protected virtual int TextGapBottom
- {
- get { return _TextGapBottom; }
- }
-
- protected virtual int TextGapLeft
- {
- get { return _TextGapLeft; }
- }
-
- protected virtual int TextGapRight
- {
- get { return _TextGapRight; }
- }
-
- protected virtual int ButtonGapTop
- {
- get { return _ButtonGapTop; }
- }
-
- protected virtual int ButtonGapBottom
- {
- get { return _ButtonGapBottom; }
- }
-
- protected virtual int ButtonGapLeft
- {
- get { return _ButtonGapLeft; }
- }
-
- protected virtual int ButtonGapRight
- {
- get { return _ButtonGapRight; }
- }
-
- protected virtual int ButtonGapBetween
- {
- get { return _ButtonGapBetween; }
- }
-
- private static Image _imageCloseEnabled = null;
- protected virtual Image ImageCloseEnabled
- {
- get
- {
- if (_imageCloseEnabled == null)
- _imageCloseEnabled = ResourceHelper.LoadBitmap(_ResourceImageCloseEnabled);
- return _imageCloseEnabled;
- }
- }
-
- private static Image _imageCloseDisabled = null;
- protected virtual Image ImageCloseDisabled
- {
- get
- {
- if (_imageCloseDisabled == null)
- _imageCloseDisabled = ResourceHelper.LoadBitmap(_ResourceImageCloseDisabled);
- return _imageCloseDisabled;
- }
- }
-
- private static Image _imageAutoHideYes = null;
- protected virtual Image ImageAutoHideYes
- {
- get
- {
- if (_imageAutoHideYes == null)
- _imageAutoHideYes = ResourceHelper.LoadBitmap(_ResourceImageAutoHideYes);
- return _imageAutoHideYes;
- }
- }
-
- private static Image _imageAutoHideNo = null;
- protected virtual Image ImageAutoHideNo
- {
- get
- {
- if (_imageAutoHideNo == null)
- _imageAutoHideNo = ResourceHelper.LoadBitmap(_ResourceImageAutoHideNo);
- return _imageAutoHideNo;
- }
- }
-
- private static string _toolTipClose = null;
- protected virtual string ToolTipClose
- {
- get
- {
- if (_toolTipClose == null)
- _toolTipClose = ResourceHelper.GetString(_ResourceToolTipClose);
- return _toolTipClose;
- }
- }
-
- private static string _toolTipAutoHide = null;
- protected virtual string ToolTipAutoHide
- {
- get
- {
- if (_toolTipAutoHide == null)
- _toolTipAutoHide = ResourceHelper.GetString(_ResourceToolTipAutoHide);
- return _toolTipAutoHide;
- }
- }
-
- protected virtual Color ActiveBackColor
- {
- get { return SystemColors.ActiveCaption; }
- }
-
- protected virtual Color InactiveBackColor
- {
- get { return SystemColors.Control; }
- }
-
- protected virtual Color ActiveTextColor
- {
- get { return SystemColors.ActiveCaptionText; }
- }
-
- protected virtual Color InactiveTextColor
- {
- get { return SystemColors.ControlText; }
- }
-
- protected virtual Color InactiveBorderColor
- {
- get { return SystemColors.GrayText; }
- }
-
- protected virtual Color ActiveButtonBorderColor
- {
- get { return ActiveTextColor; }
- }
-
- protected virtual Color InactiveButtonBorderColor
-