| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:DockPanelSkin.cs
- * 2.功能描述:类文件
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 陈晓野 2014/09/01 1.00 新建
- *******************************************************************************/
- using System;
- using System.ComponentModel;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- namespace Dongke.IBOSS.PRD.Basics.DockPanel
- {
- #region DockPanelSkin classes
- /// <summary>
- /// The skin to use when displaying the DockPanel.
- /// The skin allows custom gradient color schemes to be used when drawing the
- /// DockStrips and Tabs.
- /// </summary>
- [TypeConverter(typeof(DockPanelSkinConverter))]
- public class DockPanelSkin
- {
- private AutoHideStripSkin m_autoHideStripSkin = new AutoHideStripSkin();
- private DockPaneStripSkin m_dockPaneStripSkin = new DockPaneStripSkin();
- /// <summary>
- /// The skin used to display the auto hide strips and tabs.
- /// </summary>
- public AutoHideStripSkin AutoHideStripSkin
- {
- get
- {
- return m_autoHideStripSkin;
- }
- set
- {
- m_autoHideStripSkin = value;
- }
- }
- /// <summary>
- /// The skin used to display the Document and ToolWindow style DockStrips and Tabs.
- /// </summary>
- public DockPaneStripSkin DockPaneStripSkin
- {
- get
- {
- return m_dockPaneStripSkin;
- }
- set
- {
- m_dockPaneStripSkin = value;
- }
- }
- }
- /// <summary>
- /// The skin used to display the auto hide strip and tabs.
- /// </summary>
- [TypeConverter(typeof(AutoHideStripConverter))]
- public class AutoHideStripSkin
- {
- private DockPanelGradient m_dockStripGradient = new DockPanelGradient();
- private TabGradient m_TabGradient = new TabGradient();
- private Font m_textFont = SystemFonts.MenuFont;
- /// <summary>
- /// The gradient color skin for the DockStrips.
- /// </summary>
- public DockPanelGradient DockStripGradient
- {
- get
- {
- return m_dockStripGradient;
- }
- set
- {
- m_dockStripGradient = value;
- }
- }
- /// <summary>
- /// The gradient color skin for the Tabs.
- /// </summary>
- public TabGradient TabGradient
- {
- get
- {
- return m_TabGradient;
- }
- set
- {
- m_TabGradient = value;
- }
- }
- /// <summary>
- /// Font used in AutoHideStrip elements.
- /// </summary>
- [DefaultValue(typeof(SystemFonts), "MenuFont")]
- public Font TextFont
- {
- get
- {
- return m_textFont;
- }
- set
- {
- m_textFont = value;
- }
- }
- }
- /// <summary>
- /// The skin used to display the document and tool strips and tabs.
- /// </summary>
- [TypeConverter(typeof(DockPaneStripConverter))]
- public class DockPaneStripSkin
- {
- private DockPaneStripGradient m_DocumentGradient = new DockPaneStripGradient();
- private DockPaneStripToolWindowGradient m_ToolWindowGradient = new DockPaneStripToolWindowGradient();
- private Font m_textFont = SystemFonts.MenuFont;
- /// <summary>
- /// The skin used to display the Document style DockPane strip and tab.
- /// </summary>
- public DockPaneStripGradient DocumentGradient
- {
- get
- {
- return m_DocumentGradient;
- }
- set
- {
- m_DocumentGradient = value;
- }
- }
- /// <summary>
- /// The skin used to display the ToolWindow style DockPane strip and tab.
- /// </summary>
- public DockPaneStripToolWindowGradient ToolWindowGradient
- {
- get
- {
- return m_ToolWindowGradient;
- }
- set
- {
- m_ToolWindowGradient = value;
- }
- }
- /// <summary>
- /// Font used in DockPaneStrip elements.
- /// </summary>
- [DefaultValue(typeof(SystemFonts), "MenuFont")]
- public Font TextFont
- {
- get
- {
- return m_textFont;
- }
- set
- {
- m_textFont = value;
- }
- }
- }
- /// <summary>
- /// The skin used to display the DockPane ToolWindow strip and tab.
- /// </summary>
- [TypeConverter(typeof(DockPaneStripGradientConverter))]
- public class DockPaneStripToolWindowGradient : DockPaneStripGradient
- {
- private TabGradient m_activeCaptionGradient = new TabGradient();
- private TabGradient m_inactiveCaptionGradient = new TabGradient();
- /// <summary>
- /// The skin used to display the active ToolWindow caption.
- /// </summary>
- public TabGradient ActiveCaptionGradient
- {
- get
- {
- return m_activeCaptionGradient;
- }
- set
- {
- m_activeCaptionGradient = value;
- }
- }
- /// <summary>
- /// The skin used to display the inactive ToolWindow caption.
- /// </summary>
- public TabGradient InactiveCaptionGradient
- {
- get
- {
- return m_inactiveCaptionGradient;
- }
- set
- {
- m_inactiveCaptionGradient = value;
- }
- }
- }
- /// <summary>
- /// The skin used to display the DockPane strip and tab.
- /// </summary>
- [TypeConverter(typeof(DockPaneStripGradientConverter))]
- public class DockPaneStripGradient
- {
- private DockPanelGradient m_dockStripGradient = new DockPanelGradient();
- private TabGradient m_activeTabGradient = new TabGradient();
- private TabGradient m_inactiveTabGradient = new TabGradient();
- /// <summary>
- /// The gradient color skin for the DockStrip.
- /// </summary>
- public DockPanelGradient DockStripGradient
- {
- get
- {
- return m_dockStripGradient;
- }
- set
- {
- m_dockStripGradient = value;
- }
- }
- /// <summary>
- /// The skin used to display the active DockPane tabs.
- /// </summary>
- public TabGradient ActiveTabGradient
- {
- get
- {
- return m_activeTabGradient;
- }
- set
- {
- m_activeTabGradient = value;
- }
- }
- /// <summary>
- /// The skin used to display the inactive DockPane tabs.
- /// </summary>
- public TabGradient InactiveTabGradient
- {
- get
- {
- return m_inactiveTabGradient;
- }
- set
- {
- m_inactiveTabGradient = value;
- }
- }
- }
- /// <summary>
- /// The skin used to display the dock pane tab
- /// </summary>
- [TypeConverter(typeof(DockPaneTabGradientConverter))]
- public class TabGradient : DockPanelGradient
- {
- private Color m_textColor = SystemColors.ControlText;
- /// <summary>
- /// The text color.
- /// </summary>
- [DefaultValue(typeof(SystemColors), "ControlText")]
- public Color TextColor
- {
- get
- {
- return m_textColor;
- }
- set
- {
- m_textColor = value;
- }
- }
- }
- /// <summary>
- /// The gradient color skin.
- /// </summary>
- [TypeConverter(typeof(DockPanelGradientConverter))]
- public class DockPanelGradient
- {
- private Color m_startColor = SystemColors.Control;
- private Color m_endColor = SystemColors.Control;
- private LinearGradientMode m_linearGradientMode = LinearGradientMode.Horizontal;
- /// <summary>
- /// The beginning gradient color.
- /// </summary>
- [DefaultValue(typeof(SystemColors), "Control")]
- public Color StartColor
- {
- get
- {
- return m_startColor;
- }
- set
- {
- m_startColor = value;
- }
- }
- /// <summary>
- /// The ending gradient color.
- /// </summary>
- [DefaultValue(typeof(SystemColors), "Control")]
- public Color EndColor
- {
- get
- {
- return m_endColor;
- }
- set
- {
- m_endColor = value;
- }
- }
- /// <summary>
- /// The gradient mode to display the colors.
- /// </summary>
- [DefaultValue(LinearGradientMode.Horizontal)]
- public LinearGradientMode LinearGradientMode
- {
- get
- {
- return m_linearGradientMode;
- }
- set
- {
- m_linearGradientMode = value;
- }
- }
- }
- #endregion
- #region Converters
- public class DockPanelSkinConverter : ExpandableObjectConverter
- {
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
- {
- if (destinationType == typeof(DockPanelSkin))
- return true;
- return base.CanConvertTo(context, destinationType);
- }
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
- {
- if (destinationType == typeof(String) && value is DockPanelSkin)
- {
- return "DockPanelSkin";
- }
- return base.ConvertTo(context, culture, value, destinationType);
- }
- }
- public class DockPanelGradientConverter : ExpandableObjectConverter
- {
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
- {
- if (destinationType == typeof(DockPanelGradient))
- return true;
- return base.CanConvertTo(context, destinationType);
- }
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
- {
- if (destinationType == typeof(String) && value is DockPanelGradient)
- {
- return "DockPanelGradient";
- }
- return base.ConvertTo(context, culture, value, destinationType);
- }
- }
- public class AutoHideStripConverter : ExpandableObjectConverter
- {
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
- {
- if (destinationType == typeof(AutoHideStripSkin))
- return true;
- return base.CanConvertTo(context, destinationType);
- }
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
- {
- if (destinationType == typeof(String) && value is AutoHideStripSkin)
- {
- return "AutoHideStripSkin";
- }
- return base.ConvertTo(context, culture, value, destinationType);
- }
- }
- public class DockPaneStripConverter : ExpandableObjectConverter
- {
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
- {
- if (destinationType == typeof(DockPaneStripSkin))
- return true;
- return base.CanConvertTo(context, destinationType);
- }
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
- {
- if (destinationType == typeof(String) && value is DockPaneStripSkin)
- {
- return "DockPaneStripSkin";
- }
- return base.ConvertTo(context, culture, value, destinationType);
- }
- }
- public class DockPaneStripGradientConverter : ExpandableObjectConverter
- {
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
- {
- if (destinationType == typeof(DockPaneStripGradient))
- return true;
- return base.CanConvertTo(context, destinationType);
- }
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
- {
- if (destinationType == typeof(String) && value is DockPaneStripGradient)
- {
- return "DockPaneStripGradient";
- }
- return base.ConvertTo(context, culture, value, destinationType);
- }
- }
- public class DockPaneTabGradientConverter : ExpandableObjectConverter
- {
- public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
- {
- if (destinationType == typeof(TabGradient))
- return true;
- return base.CanConvertTo(context, destinationType);
- }
- public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
- {
- TabGradient val = value as TabGradient;
- if (destinationType == typeof(String) && val != null)
- {
- return "DockPaneTabGradient";
- }
- return base.ConvertTo(context, culture, value, destinationType);
- }
- }
- #endregion
- }
|