DotNet 4.8.1 build of DotNetBar
This commit is contained in:
@@ -0,0 +1,615 @@
|
||||
using System.Drawing;
|
||||
using DevComponents.DotNetBar.Metro.ColorTables;
|
||||
using DevComponents.DotNetBar.Metro.Rendering;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Create the Metro Visual Style for SuperGridControl.
|
||||
/// </summary>
|
||||
public class MetroStyleFactory : VisualStyleFactory
|
||||
{
|
||||
private MetroPartColors _MetroPartColors;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MetroStyleFactory class.
|
||||
/// </summary>
|
||||
public MetroStyleFactory()
|
||||
{
|
||||
_MetroPartColors = MetroRender.GetColorTable().MetroPartColors;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MetroStyleFactory class.
|
||||
/// </summary>
|
||||
/// <param name="metroPartColors">Metro Part Colors to Initialize Style with.</param>
|
||||
public MetroStyleFactory(MetroPartColors metroPartColors)
|
||||
{
|
||||
_MetroPartColors = metroPartColors;
|
||||
|
||||
if (metroPartColors == null)
|
||||
_MetroPartColors = MetroRender.GetColorTable().MetroPartColors;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the DefaultVisualStyle for SuperGridControl.
|
||||
/// </summary>
|
||||
/// <param name="factory">Color-Factory used to generate colors.</param>
|
||||
/// <returns>New instance of DefaultVisualStyles class.</returns>s
|
||||
public override DefaultVisualStyles CreateStyle(ColorFactory factory)
|
||||
{
|
||||
DefaultVisualStyles visualStyle = new DefaultVisualStyles();
|
||||
|
||||
InitGridPanelStyle(visualStyle, factory);
|
||||
|
||||
InitCellStyles(visualStyle, factory);
|
||||
InitMergedCellStyles(visualStyle, factory);
|
||||
InitAltRowCellStyles(visualStyle, factory);
|
||||
|
||||
InitColumnStyles(visualStyle, factory);
|
||||
InitAltColumnStyles(visualStyle, factory);
|
||||
InitColumnHeaderStyles(visualStyle, factory);
|
||||
|
||||
InitRowStyles(visualStyle, factory);
|
||||
InitTextRowStyles(visualStyle, factory);
|
||||
|
||||
InitGroupHeaderStyles(visualStyle, factory);
|
||||
|
||||
InitFilterRowStyles(visualStyle, factory);
|
||||
InitFilterColumnHeaderStyles(visualStyle, factory);
|
||||
|
||||
InitGroupByStyles(visualStyle, factory);
|
||||
|
||||
return (visualStyle);
|
||||
}
|
||||
|
||||
#region InitGridPanelStyle
|
||||
|
||||
private void InitGridPanelStyle(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
GridPanelVisualStyle style = new GridPanelVisualStyle();
|
||||
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
style.Background = new Background(factory.GetColor(metroColors.EditControlBackColor));
|
||||
style.BorderColor = new BorderColor(factory.GetColor(metroColors.CanvasColorDarkShade));
|
||||
style.BorderPattern.All = LinePattern.Solid;
|
||||
style.BorderThickness = new Thickness(1);
|
||||
style.TextColor = factory.GetColor(metroColors.TextColor);
|
||||
|
||||
style.TreeLineColor = factory.GetColor(metroColors.CanvasColorLighterShade);
|
||||
style.HeaderLineColor = factory.GetColor(metroColors.CanvasColorDarkShade);
|
||||
style.HorizontalLineColor = factory.GetColor(metroColors.CanvasColorLighterShade);
|
||||
style.VerticalLineColor = factory.GetColor(metroColors.CanvasColorLighterShade);
|
||||
|
||||
style.TreeLinePattern = LinePattern.Solid;
|
||||
style.HorizontalLinePattern = LinePattern.Solid;
|
||||
style.VerticalLinePattern = LinePattern.Solid;
|
||||
style.HeaderHLinePattern = LinePattern.Solid;
|
||||
style.HeaderVLinePattern = LinePattern.Solid;
|
||||
|
||||
BaseTreeButtonVisualStyle tstyle = new BaseTreeButtonVisualStyle();
|
||||
|
||||
tstyle.BorderColor = factory.GetColor(metroColors.CanvasColorDarkShade);
|
||||
tstyle.HotBorderColor = factory.GetColor(metroColors.CanvasColorDarkShade);
|
||||
tstyle.LineColor = factory.GetColor(metroColors.CanvasColorDarkShade);
|
||||
tstyle.HotLineColor = factory.GetColor(metroColors.CanvasColorDarkShade);
|
||||
tstyle.Background = new Background(factory.GetColor(metroColors.EditControlBackColor), factory.GetColor(metroColors.EditControlBackColor), 90);
|
||||
tstyle.HotBackground = new Background(factory.GetColor(metroColors.CanvasColor), factory.GetColor(metroColors.CanvasColor), 90);
|
||||
|
||||
style.CircleTreeButtonStyle.CollapseButton = tstyle;
|
||||
style.CircleTreeButtonStyle.ExpandButton = tstyle;
|
||||
|
||||
style.SquareTreeButtonStyle.CollapseButton = tstyle;
|
||||
style.SquareTreeButtonStyle.ExpandButton = tstyle;
|
||||
|
||||
style.TriangleTreeButtonStyle.CollapseButton = tstyle;
|
||||
style.TriangleTreeButtonStyle.ExpandButton = tstyle;
|
||||
|
||||
style.TriangleTreeButtonStyle.ExpandButton = tstyle;
|
||||
visualStyle.GridPanelStyle = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitColumnHeaderStyles
|
||||
|
||||
private void InitColumnHeaderStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
ColumnHeaderRowVisualStyle style = new ColumnHeaderRowVisualStyle();
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(metroColors.CanvasColorDarkShade);
|
||||
|
||||
style.FilterBackground = new Background(
|
||||
Color.White, factory.GetColor(metroColors.CanvasColorDarkShade), 0);
|
||||
|
||||
style.WhiteSpaceBackground = new Background(factory.GetColor(metroColors.CanvasColor));
|
||||
|
||||
style.RowHeader.Background = new
|
||||
Background(factory.GetColor(metroColors.CanvasColorLighterShade));
|
||||
|
||||
style.RowHeader.BorderHighlightColor = GetBorderHighlight();
|
||||
|
||||
style.IndicatorBackground = new Background(factory.GetColor(metroColors.ComplementColor));
|
||||
style.IndicatorBorderColor = factory.GetColor(metroColors.ComplementColorDark);
|
||||
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.Default] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(metroColors.ComplementColor);
|
||||
|
||||
style.FilterBackground = new Background(
|
||||
Color.White, factory.GetColor(metroColors.ComplementColor), 45);
|
||||
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.Selected] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(metroColors.CanvasColorDarkShade);
|
||||
|
||||
style.FilterBackground = new Background(
|
||||
Color.White, factory.GetColor(metroColors.BaseColorDark), 0);
|
||||
|
||||
style.RowHeader.Background = new Background(
|
||||
factory.GetColor(metroColors.CanvasColorLightShade));
|
||||
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.MouseOver] = style;
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.SelectedMouseOver] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitTextRowStyles
|
||||
|
||||
private void InitTextRowStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
TextRowVisualStyle style = new TextRowVisualStyle();
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
style.Alignment = Alignment.MiddleCenter;
|
||||
style.AllowWrap = Tbool.True;
|
||||
|
||||
style.Background = new Background(factory.GetColor(metroColors.EditControlBackColor));
|
||||
style.BorderColor = new BorderColor(factory.GetColor(metroColors.CanvasColorLighterShade));
|
||||
|
||||
style.Padding.All = 2;
|
||||
|
||||
style.TextColor = factory.GetColor(metroColors.TextColor);
|
||||
|
||||
style.RowHeaderStyle.Background = new Background(factory.GetColor(metroColors.CanvasColorLighterShade));
|
||||
style.RowHeaderStyle.BorderHighlightColor = GetBorderHighlight();
|
||||
|
||||
visualStyle.TitleStyles[StyleType.Default] = style;
|
||||
visualStyle.HeaderStyles[StyleType.Default] = style.Copy();
|
||||
visualStyle.FooterStyles[StyleType.Default] = style.Copy();
|
||||
|
||||
style = style.Copy();
|
||||
style.Background = new Background(Color.Transparent);
|
||||
|
||||
visualStyle.CaptionStyles[StyleType.Default] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitCellStyles
|
||||
|
||||
private void InitCellStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
CellVisualStyle style = new CellVisualStyle();
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
style.Alignment = Alignment.MiddleLeft;
|
||||
style.Background = new Background(factory.GetColor(metroColors.EditControlBackColor));
|
||||
style.BorderColor = new BorderColor(factory.GetColor(metroColors.CanvasColorLighterShade));
|
||||
style.BorderPattern.All = LinePattern.Solid;
|
||||
style.BorderThickness.All = 0;
|
||||
style.Font = SystemFonts.DefaultFont;
|
||||
style.ImageAlignment = Alignment.MiddleLeft;
|
||||
style.ImagePadding.All = 2;
|
||||
style.Margin.All = 0;
|
||||
style.ImageOverlay = ImageOverlay.None;
|
||||
style.Padding.All = 0;
|
||||
style.TextColor = metroColors.TextColor;
|
||||
|
||||
visualStyle.CellStyles[StyleType.Default] = style;
|
||||
|
||||
style = new CellVisualStyle();
|
||||
style.TextColor = metroColors.CanvasColorDarkShade;
|
||||
visualStyle.CellStyles[StyleType.ReadOnly] = style;
|
||||
|
||||
style = new CellVisualStyle();
|
||||
style.Background = GetDefaultSelectedBackground(factory);
|
||||
style.TextColor = factory.GetColor(metroColors.BaseTextColor);
|
||||
|
||||
visualStyle.CellStyles[StyleType.Selected] = style;
|
||||
visualStyle.CellStyles[StyleType.ReadOnlySelected] = style.Copy();
|
||||
|
||||
style = new CellVisualStyle();
|
||||
style.Background = GetSelectedMouseOverBackground(factory);
|
||||
style.TextColor = factory.GetColor(metroColors.BaseColorLightText);
|
||||
|
||||
visualStyle.CellStyles[StyleType.SelectedMouseOver] = style;
|
||||
visualStyle.CellStyles[StyleType.ReadOnlySelectedMouseOver] = style.Copy();
|
||||
|
||||
style = new CellVisualStyle();
|
||||
style.Background = new Background(factory.GetColor(metroColors.EditControlBackColor));
|
||||
|
||||
visualStyle.CellStyles[StyleType.Empty] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitMergedCellStyles
|
||||
|
||||
private void InitMergedCellStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
visualStyle.MergedCellStyles[StyleType.Default] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.ReadOnly] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.Selected] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.ReadOnlySelected] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.SelectedMouseOver] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.ReadOnlySelectedMouseOver] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.Empty] = new CellVisualStyle();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitAltRowCellStyles
|
||||
|
||||
private void InitAltRowCellStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
visualStyle.AlternateRowCellStyles[StyleType.Default].Background =
|
||||
new Background(factory.GetColor((metroColors.CanvasColor == metroColors.EditControlBackColor) ? metroColors.CanvasColorLightShade : metroColors.CanvasColor));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitColumnStyles
|
||||
|
||||
private void InitColumnStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
ColumnHeaderVisualStyle colStyle = new ColumnHeaderVisualStyle();
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
colStyle.Alignment = Alignment.MiddleCenter;
|
||||
colStyle.BorderColor = new BorderColor(factory.GetColor(metroColors.CanvasColorLightShade));
|
||||
colStyle.BorderPattern.All = LinePattern.Solid;
|
||||
colStyle.BorderThickness.All = 0;
|
||||
colStyle.Font = SystemFonts.CaptionFont;
|
||||
colStyle.ImageAlignment = Alignment.MiddleLeft;
|
||||
colStyle.Margin.All = 0;
|
||||
colStyle.ImageOverlay = ImageOverlay.None;
|
||||
colStyle.TextColor = factory.GetColor(metroColors.TextColor);
|
||||
|
||||
colStyle.Background = new Background(factory.GetColor(metroColors.CanvasColorLighterShade));
|
||||
|
||||
visualStyle.ColumnHeaderStyles[StyleType.Default] = colStyle;
|
||||
visualStyle.ColumnHeaderStyles[StyleType.ReadOnly] = colStyle.Copy();
|
||||
visualStyle.ColumnHeaderStyles[StyleType.ReadOnly].Font = null;
|
||||
|
||||
colStyle = new ColumnHeaderVisualStyle();
|
||||
colStyle.Background = new Background(factory.GetColor(metroColors.CanvasColorLightShade));
|
||||
visualStyle.ColumnHeaderStyles[StyleType.MouseOver] = colStyle;
|
||||
visualStyle.ColumnHeaderStyles[StyleType.ReadOnlyMouseOver] = colStyle.Copy();
|
||||
|
||||
colStyle = new ColumnHeaderVisualStyle();
|
||||
colStyle.Background = GetDefaultSelectedColumnBackground(factory);
|
||||
visualStyle.ColumnHeaderStyles[StyleType.Selected] = colStyle;
|
||||
visualStyle.ColumnHeaderStyles[StyleType.ReadOnlySelected] = colStyle.Copy();
|
||||
|
||||
colStyle = new ColumnHeaderVisualStyle();
|
||||
colStyle.Background = GetSelectedColumnMouseOverBackground();
|
||||
visualStyle.ColumnHeaderStyles[StyleType.SelectedMouseOver] = colStyle;
|
||||
visualStyle.ColumnHeaderStyles[StyleType.ReadOnlySelectedMouseOver] = colStyle.Copy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitAltColumnStyles
|
||||
|
||||
private void InitAltColumnStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
visualStyle.AlternateColumnCellStyles[StyleType.Default].Background =
|
||||
new Background(factory.GetColor(metroColors.EditControlBackColor));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitRowStyles
|
||||
|
||||
private void InitRowStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
visualStyle.RowStyles[StyleType.Default] = GetDefaultRowStyle();
|
||||
visualStyle.RowStyles[StyleType.MouseOver] = GetMouseOverRowStyle();
|
||||
visualStyle.RowStyles[StyleType.SelectedMouseOver] = GetSelectedMouseOverRowStyle(visualStyle, factory);
|
||||
}
|
||||
|
||||
#region GetDefaultRowStyle
|
||||
|
||||
private RowVisualStyle GetDefaultRowStyle()
|
||||
{
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
RowVisualStyle rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = new Background(metroColors.EditControlBackColor);
|
||||
|
||||
RowHeaderVisualStyle style = new RowHeaderVisualStyle();
|
||||
|
||||
style.Font = SystemFonts.DefaultFont;
|
||||
style.TextColor = metroColors.TextColor;
|
||||
|
||||
Background bg = new Background(metroColors.CanvasColorLighterShade);
|
||||
style.Background = bg;
|
||||
|
||||
bg = new Background(metroColors.BaseColor);
|
||||
style.ActiveRowBackground = bg;
|
||||
style.DirtyMarkerBackground = new Background(metroColors.BaseColorDarker);
|
||||
style.BorderHighlightColor = GetBorderHighlight();
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
return (rowStyle);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetMouseOverRowStyle
|
||||
|
||||
private RowVisualStyle GetMouseOverRowStyle()
|
||||
{
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
RowVisualStyle rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = new Background(metroColors.EditControlBackColor);
|
||||
|
||||
RowHeaderVisualStyle style = new RowHeaderVisualStyle();
|
||||
style.Background = new Background(metroColors.CanvasColorLighterShade);
|
||||
style.ActiveRowBackground = new Background(metroColors.CanvasColorLightShade);
|
||||
|
||||
Background bg = new Background(metroColors.CanvasColorLightShade);
|
||||
style.Background = bg;
|
||||
|
||||
bg = new Background(metroColors.BaseColor);
|
||||
style.ActiveRowBackground = bg;
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
return (rowStyle);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSelectedMouseOverRowStyle
|
||||
|
||||
private RowVisualStyle GetSelectedMouseOverRowStyle(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
RowVisualStyle rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = GetDefaultSelectedBackground(factory);
|
||||
|
||||
RowHeaderVisualStyle style = new RowHeaderVisualStyle();
|
||||
style.Background = new Background(metroColors.BaseColor);
|
||||
style.ActiveRowBackground = new Background(metroColors.BaseColor);
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
visualStyle.RowStyles[StyleType.Selected] = rowStyle;
|
||||
|
||||
rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = GetSelectedColumnMouseOverBackground();
|
||||
|
||||
style = new RowHeaderVisualStyle();
|
||||
style.Background = new Background(metroColors.BaseColor);
|
||||
style.ActiveRowBackground = new Background(metroColors.BaseColor);
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
return (rowStyle);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitGroupHeaderStyles
|
||||
|
||||
private void InitGroupHeaderStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
GroupHeaderVisualStyle style = new GroupHeaderVisualStyle();
|
||||
|
||||
style.AllowWrap = Tbool.True;
|
||||
style.Alignment = Alignment.MiddleLeft;
|
||||
style.Font = SystemFonts.DefaultFont;
|
||||
|
||||
style.Background = new
|
||||
Background(factory.GetColor(metroColors.EditControlBackColor));
|
||||
|
||||
style.UnderlineColor = factory.GetColor(metroColors.ComplementColor);
|
||||
|
||||
style.RowHeaderStyle.Background = new Background(factory.GetColor(metroColors.CanvasColorLighterShade));
|
||||
style.RowHeaderStyle.BorderHighlightColor = GetBorderHighlight();
|
||||
style.RowHeaderStyle.Font = SystemFonts.DefaultFont;
|
||||
|
||||
style.TextColor = metroColors.TextColor;
|
||||
|
||||
visualStyle.GroupHeaderStyles[StyleType.Default] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedColumnBackground
|
||||
private Background GetDefaultSelectedColumnBackground(ColorFactory factory)
|
||||
{
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
Background bg = new Background(factory.GetColor(metroColors.CanvasColorLighterShade),
|
||||
factory.GetColor(metroColors.CanvasColorLightShade));
|
||||
|
||||
return (bg);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedBackground
|
||||
|
||||
private Background GetDefaultSelectedBackground(ColorFactory factory)
|
||||
{
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
Background bg = new Background(factory.GetColor(metroColors.BaseColor));
|
||||
|
||||
return (bg);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedColumnMouseOverStyle
|
||||
|
||||
private Background GetSelectedColumnMouseOverBackground()
|
||||
{
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
return (new Background(metroColors.BaseColorLight));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedMouseOverStyle
|
||||
|
||||
private Background GetSelectedMouseOverBackground(ColorFactory factory)
|
||||
{
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
return (new Background(factory.GetColor(metroColors.BaseColorLight)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitFilterColumnHeaderStyles
|
||||
|
||||
private void InitFilterColumnHeaderStyles(
|
||||
DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
FilterColumnHeaderVisualStyle colStyle = new FilterColumnHeaderVisualStyle();
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
colStyle.Alignment = Alignment.MiddleCenter;
|
||||
colStyle.Font = SystemFonts.CaptionFont;
|
||||
|
||||
colStyle.TextColor = factory.GetColor(metroColors.TextColor);
|
||||
colStyle.ErrorTextColor = factory.GetColor(metroColors.BaseColorDarker);
|
||||
|
||||
colStyle.Background = new Background(factory.GetColor(metroColors.CanvasColorLighterShade));
|
||||
colStyle.GripBarBackground = new Background(factory.GetColor(metroColors.CanvasColor));
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.Default] = colStyle;
|
||||
|
||||
colStyle = new FilterColumnHeaderVisualStyle();
|
||||
colStyle.Background = new Background(factory.GetColor(metroColors.CanvasColorLightShade));
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.MouseOver] = colStyle;
|
||||
|
||||
colStyle = new FilterColumnHeaderVisualStyle();
|
||||
colStyle.Background = GetDefaultSelectedColumnBackground(factory);
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.Selected] = colStyle;
|
||||
|
||||
colStyle = new FilterColumnHeaderVisualStyle();
|
||||
colStyle.Background = GetSelectedColumnMouseOverBackground();
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.SelectedMouseOver] = colStyle;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitFilterRowStyles
|
||||
|
||||
private void InitFilterRowStyles(
|
||||
DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
FilterRowVisualStyle style = new FilterRowVisualStyle();
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(0x787D87);
|
||||
|
||||
style.FilterBackground = new Background(
|
||||
Color.White, factory.GetColor(metroColors.CanvasColorDarkShade), 0);
|
||||
|
||||
style.WhiteSpaceBackground = new Background(factory.GetColor(metroColors.EditControlBackColor));
|
||||
|
||||
style.RowHeader.Background = new
|
||||
Background(factory.GetColor(metroColors.CanvasColorLighterShade));
|
||||
|
||||
style.RowHeader.BorderHighlightColor = GetBorderHighlight();
|
||||
|
||||
visualStyle.FilterRowStyles[StyleType.Default] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBackground = new Background(
|
||||
Color.White, factory.GetColor(metroColors.ComplementColor), 45);
|
||||
|
||||
visualStyle.FilterRowStyles[StyleType.Selected] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBackground = new Background(
|
||||
Color.White, factory.GetColor(metroColors.BaseColorDark), 0);
|
||||
|
||||
style.RowHeader.Background = new
|
||||
Background(factory.GetColor(metroColors.CanvasColorLightShade));
|
||||
|
||||
visualStyle.FilterRowStyles[StyleType.MouseOver] = style;
|
||||
visualStyle.FilterRowStyles[StyleType.SelectedMouseOver] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitGroupByStyles
|
||||
|
||||
private void InitGroupByStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
GroupByVisualStyle style = new GroupByVisualStyle();
|
||||
MetroPartColors metroColors = _MetroPartColors;
|
||||
|
||||
style.Alignment = Alignment.MiddleCenter;
|
||||
style.GroupBoxConnectorColor = factory.GetColor(metroColors.BaseColorDark); // Panel border color
|
||||
style.GroupBoxBorderColor = factory.GetColor(metroColors.BaseColorDark);
|
||||
|
||||
style.InsertMarkerBorderColor = factory.GetColor(metroColors.BaseColorDark);
|
||||
style.InsertMarkerBackground = GetSelectedColumnMouseOverBackground();
|
||||
|
||||
style.RowHeaderStyle.Background = new Background(factory.GetColor(metroColors.CanvasColorLighterShade));
|
||||
style.RowHeaderStyle.BorderHighlightColor = GetBorderHighlight();
|
||||
|
||||
style.TextColor = factory.GetColor(0x363636); // Col text color
|
||||
style.GroupBoxBackground = new Background(factory.GetColor(metroColors.CanvasColorLighterShade)); // col background
|
||||
visualStyle.GroupByStyles[StyleType.Default] = style;
|
||||
|
||||
style = new GroupByVisualStyle();
|
||||
style.GroupBoxBackground = new Background(factory.GetColor(metroColors.CanvasColorLightShade)); // col background
|
||||
visualStyle.GroupByStyles[StyleType.MouseOver] = style;
|
||||
|
||||
style = new GroupByVisualStyle();
|
||||
style.GroupBoxBackground = GetDefaultSelectedColumnBackground(factory); // col background
|
||||
visualStyle.GroupByStyles[StyleType.Selected] = style;
|
||||
|
||||
style = new GroupByVisualStyle();
|
||||
style.GroupBoxBackground = GetSelectedColumnMouseOverBackground(); // col background
|
||||
visualStyle.GroupByStyles[StyleType.SelectedMouseOver] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetBorderHighlight
|
||||
|
||||
private Color GetBorderHighlight()
|
||||
{
|
||||
return (Color.Transparent);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,590 @@
|
||||
using System.Drawing;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// Office2010BlackStyleFactory
|
||||
///</summary>
|
||||
public class Office2010BlackStyleFactory : VisualStyleFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Create the DefaultVisualStyle for SuperGridControl.
|
||||
/// </summary>
|
||||
/// <param name="factory">Color-Factory used to generate colors.</param>
|
||||
/// <returns>New instance of DefaultVisualStyles class.</returns>s
|
||||
public override DefaultVisualStyles CreateStyle(ColorFactory factory)
|
||||
{
|
||||
DefaultVisualStyles visualStyle = new DefaultVisualStyles();
|
||||
|
||||
InitGridPanelStyle(visualStyle, factory);
|
||||
|
||||
InitCellStyles(visualStyle, factory);
|
||||
InitMergedCellStyles(visualStyle, factory);
|
||||
InitAltRowCellStyles(visualStyle, factory);
|
||||
|
||||
InitColumnStyles(visualStyle, factory);
|
||||
InitAltColumnStyles(visualStyle, factory);
|
||||
InitColumnHeaderStyles(visualStyle, factory);
|
||||
|
||||
InitRowStyles(visualStyle, factory);
|
||||
InitTextRowStyles(visualStyle, factory);
|
||||
|
||||
InitGroupHeaderStyles(visualStyle, factory);
|
||||
|
||||
InitFilterRowStyles(visualStyle, factory);
|
||||
InitFilterColumnHeaderStyles(visualStyle, factory);
|
||||
|
||||
InitGroupByStyles(visualStyle, factory);
|
||||
|
||||
return (visualStyle);
|
||||
}
|
||||
|
||||
#region InitGridPanelStyle
|
||||
|
||||
private void InitGridPanelStyle(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
GridPanelVisualStyle style = new GridPanelVisualStyle();
|
||||
|
||||
style.Background = new Background(factory.GetColor(0xFFFFFF));
|
||||
style.BorderColor = new BorderColor(factory.GetColor(0x313131));
|
||||
style.BorderPattern.All = LinePattern.Solid;
|
||||
style.BorderThickness = new Thickness(1);
|
||||
style.TextColor = factory.GetColor(0x000000);
|
||||
|
||||
style.TreeLineColor = factory.GetColor(0x484848);
|
||||
style.HeaderLineColor = factory.GetColor(0x444444);
|
||||
style.HorizontalLineColor = factory.GetColor(0xDADCDD);
|
||||
style.VerticalLineColor = factory.GetColor(0xDADCDD);
|
||||
|
||||
style.TreeLinePattern = LinePattern.Solid;
|
||||
style.HorizontalLinePattern = LinePattern.Solid;
|
||||
style.VerticalLinePattern = LinePattern.Solid;
|
||||
style.HeaderHLinePattern = LinePattern.Solid;
|
||||
style.HeaderVLinePattern = LinePattern.Solid;
|
||||
|
||||
BaseTreeButtonVisualStyle tstyle = new BaseTreeButtonVisualStyle();
|
||||
|
||||
tstyle.BorderColor = factory.GetColor(Color.SlateGray);
|
||||
tstyle.HotBorderColor = factory.GetColor(Color.SlateGray);
|
||||
tstyle.LineColor = factory.GetColor(Color.DarkSlateGray);
|
||||
tstyle.HotLineColor = factory.GetColor(Color.DarkSlateGray);
|
||||
tstyle.Background = new Background(factory.GetColor(Color.White), factory.GetColor(Color.Gainsboro), 90);
|
||||
tstyle.HotBackground = new Background(factory.GetColor(Color.White), factory.GetColor(Color.Gainsboro), 90);
|
||||
|
||||
style.CircleTreeButtonStyle.CollapseButton = tstyle;
|
||||
style.CircleTreeButtonStyle.ExpandButton = tstyle;
|
||||
|
||||
style.SquareTreeButtonStyle.CollapseButton = tstyle;
|
||||
style.SquareTreeButtonStyle.ExpandButton = tstyle;
|
||||
|
||||
tstyle = new BaseTreeButtonVisualStyle();
|
||||
|
||||
tstyle.BorderColor = factory.GetColor(Color.Black);
|
||||
tstyle.HotBorderColor = factory.GetColor(0x27C7F7);
|
||||
tstyle.Background = new Background(factory.GetColor(Color.Black));
|
||||
tstyle.HotBackground = new Background(factory.GetColor(0xC7EBFA));
|
||||
|
||||
style.TriangleTreeButtonStyle.CollapseButton = tstyle;
|
||||
|
||||
tstyle = new BaseTreeButtonVisualStyle();
|
||||
|
||||
tstyle.BorderColor = factory.GetColor(Color.DimGray);
|
||||
tstyle.HotBorderColor = factory.GetColor(0x27C7F7);
|
||||
tstyle.Background = new Background(factory.GetColor(Color.White));
|
||||
tstyle.HotBackground = new Background(factory.GetColor(0xC7EBFA));
|
||||
|
||||
style.TriangleTreeButtonStyle.ExpandButton = tstyle;
|
||||
|
||||
visualStyle.GridPanelStyle = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitColumnHeaderStyles
|
||||
|
||||
private void InitColumnHeaderStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
ColumnHeaderRowVisualStyle style = new ColumnHeaderRowVisualStyle();
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(Color.LightGray);
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(Color.LightGray), 0);
|
||||
|
||||
style.WhiteSpaceBackground = new Background(factory.GetColor(0x797979));
|
||||
style.RowHeader.Background = new Background(factory.GetColor(0x6A6A6A), factory.GetColor(0x595959), BackFillType.ForwardDiagonal);
|
||||
|
||||
style.RowHeader.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
style.IndicatorBackground = new Background(factory.GetColor(0xF9FAFB), factory.GetColor(0xD7DAE2), BackFillType.Angle);
|
||||
style.IndicatorBorderColor = factory.GetColor(0xBDCFE8);
|
||||
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.Default] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(Color.LightGreen);
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(Color.Green), 45);
|
||||
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.Selected] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(0x797979);
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(0xE2AA00), 0);
|
||||
|
||||
style.RowHeader.Background = new Background(factory.GetColor(0x8E8E8E));
|
||||
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.MouseOver] = style;
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.SelectedMouseOver] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitTextRowStyles
|
||||
|
||||
private void InitTextRowStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
TextRowVisualStyle style = new TextRowVisualStyle();
|
||||
|
||||
style.Alignment = Alignment.MiddleCenter;
|
||||
style.AllowWrap = Tbool.True;
|
||||
|
||||
style.Background = new Background(factory.GetColor(0x6A6A6A));
|
||||
style.BorderColor = new BorderColor(factory.GetColor(0x444444));
|
||||
|
||||
style.Padding.All = 2;
|
||||
|
||||
style.TextColor = factory.GetColor(0xE2E2E2);
|
||||
|
||||
style.RowHeaderStyle.Background = new Background(factory.GetColor(0x6A6A6A));
|
||||
style.RowHeaderStyle.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
visualStyle.TitleStyles[StyleType.Default] = style;
|
||||
visualStyle.HeaderStyles[StyleType.Default] = style.Copy();
|
||||
visualStyle.FooterStyles[StyleType.Default] = style.Copy();
|
||||
|
||||
style = style.Copy();
|
||||
style.Background = new Background(factory.GetColor(0x686868));
|
||||
|
||||
visualStyle.CaptionStyles[StyleType.Default] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitCellStyles
|
||||
|
||||
private void InitCellStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
CellVisualStyle style = new CellVisualStyle();
|
||||
|
||||
style.Alignment = Alignment.MiddleLeft;
|
||||
style.Background = new Background(factory.GetColor(Color.White));
|
||||
style.Font = SystemFonts.DefaultFont;
|
||||
style.ImageAlignment = Alignment.MiddleLeft;
|
||||
style.ImagePadding.All = 2;
|
||||
style.Margin.All = 0;
|
||||
style.ImageOverlay = ImageOverlay.None;
|
||||
style.Padding.All = 0;
|
||||
style.TextColor = Color.Black;
|
||||
|
||||
visualStyle.CellStyles[StyleType.Default] = style;
|
||||
|
||||
style = new CellVisualStyle();
|
||||
style.Background = GetDefaultSelectedBackground(factory);
|
||||
|
||||
visualStyle.CellStyles[StyleType.Selected] = style;
|
||||
|
||||
style = new CellVisualStyle();
|
||||
style.Background = GetSelectedMouseOverBackground(factory);
|
||||
|
||||
visualStyle.CellStyles[StyleType.SelectedMouseOver] = style;
|
||||
|
||||
style = new CellVisualStyle();
|
||||
style.Background = new Background(factory.GetColor(0xF4F4F4));
|
||||
|
||||
visualStyle.CellStyles[StyleType.Empty] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitMergedCellStyles
|
||||
|
||||
private void InitMergedCellStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
visualStyle.MergedCellStyles[StyleType.Default] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.ReadOnly] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.Selected] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.ReadOnlySelected] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.SelectedMouseOver] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.ReadOnlySelectedMouseOver] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.Empty] = new CellVisualStyle();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitAltRowCellStyles
|
||||
|
||||
private void InitAltRowCellStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
visualStyle.AlternateRowCellStyles[StyleType.Default].Background =
|
||||
new Background(factory.GetColor(0xF4F4F4));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitColumnStyles
|
||||
|
||||
private void InitColumnStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
ColumnHeaderVisualStyle colStyle = new ColumnHeaderVisualStyle();
|
||||
|
||||
colStyle.Alignment = Alignment.MiddleCenter;
|
||||
colStyle.Font = SystemFonts.CaptionFont;
|
||||
colStyle.ImageAlignment = Alignment.MiddleLeft;
|
||||
colStyle.Margin.All = 0;
|
||||
colStyle.ImageOverlay = ImageOverlay.None;
|
||||
colStyle.TextColor = factory.GetColor(0xE2E2E2);
|
||||
|
||||
colStyle.Background = new Background(factory.GetColor(0x6A6A6A));
|
||||
visualStyle.ColumnHeaderStyles[StyleType.Default] = colStyle;
|
||||
colStyle = new ColumnHeaderVisualStyle();
|
||||
|
||||
colStyle.Background = new Background(factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6));
|
||||
colStyle.TextColor = factory.GetColor(0x444444);
|
||||
visualStyle.ColumnHeaderStyles[StyleType.MouseOver] = colStyle;
|
||||
|
||||
colStyle = new ColumnHeaderVisualStyle();
|
||||
colStyle.Background = GetDefaultSelectedColumnBackground(factory);
|
||||
colStyle.TextColor = factory.GetColor(0x444444);
|
||||
visualStyle.ColumnHeaderStyles[StyleType.Selected] = colStyle;
|
||||
|
||||
colStyle = new ColumnHeaderVisualStyle();
|
||||
colStyle.Background = GetSelectedColumnMouseOverBackground(factory);
|
||||
colStyle.TextColor = factory.GetColor(0x444444);
|
||||
visualStyle.ColumnHeaderStyles[StyleType.SelectedMouseOver] = colStyle;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitAltColumnStyles
|
||||
|
||||
private void InitAltColumnStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
visualStyle.AlternateColumnCellStyles[StyleType.Default].Background =
|
||||
new Background(factory.GetColor(0xEAF2FB));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitRowStyles
|
||||
|
||||
private void InitRowStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
visualStyle.RowStyles[StyleType.Default] = GetDefaultRowStyle(factory);
|
||||
visualStyle.RowStyles[StyleType.MouseOver] = GetMouseOverRowStyle(factory);
|
||||
visualStyle.RowStyles[StyleType.SelectedMouseOver] = GetSelectedMouseOverRowStyle(visualStyle, factory);
|
||||
}
|
||||
|
||||
#region GetDefaultRowStyle
|
||||
|
||||
private RowVisualStyle GetDefaultRowStyle(ColorFactory factory)
|
||||
{
|
||||
RowVisualStyle rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = new Background(factory.GetColor(Color.White));
|
||||
|
||||
RowHeaderVisualStyle style = new RowHeaderVisualStyle();
|
||||
|
||||
style.Font = SystemFonts.DefaultFont;
|
||||
style.TextColor = factory.GetColor(0x1E395B);
|
||||
|
||||
Background bg = new Background();
|
||||
BackColorBlend bcb = new BackColorBlend();
|
||||
|
||||
bcb.Colors = new Color[3];
|
||||
bcb.Colors[0] = factory.GetColor(0x6A6A6A);
|
||||
bcb.Colors[1] = factory.GetColor(0x6A6A6A);
|
||||
bcb.Colors[2] = factory.GetColor(0x5E5E5E);
|
||||
|
||||
bcb.Positions = new float[3];
|
||||
bcb.Positions[0] = 0f;
|
||||
bcb.Positions[1] = .75f;
|
||||
bcb.Positions[2] = 1f;
|
||||
|
||||
bg.BackColorBlend = bcb;
|
||||
bg.GradientAngle = 0;
|
||||
|
||||
style.Background = bg;
|
||||
style.TextColor = factory.GetColor(0xE2E2E2);
|
||||
|
||||
bg = new Background(factory.GetColor(0x6A6A6A));
|
||||
|
||||
style.ActiveRowBackground = bg;
|
||||
style.DirtyMarkerBackground = new Background(factory.GetColor(0xAE054F), factory.GetColor(0xE75E94), BackFillType.VerticalCenter);
|
||||
style.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
return (rowStyle);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetMouseOverRowStyle
|
||||
|
||||
private RowVisualStyle GetMouseOverRowStyle(ColorFactory factory)
|
||||
{
|
||||
RowVisualStyle rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = new Background(Color.White);
|
||||
|
||||
RowHeaderVisualStyle style = new RowHeaderVisualStyle();
|
||||
style.Background = new Background(Color.Plum);
|
||||
style.ActiveRowBackground = new Background(Color.Blue);
|
||||
|
||||
Background bg = new Background();
|
||||
BackColorBlend bcb = new BackColorBlend();
|
||||
|
||||
bcb.Colors = new Color[3];
|
||||
bcb.Colors[0] = factory.GetColor(0xFFE575);
|
||||
bcb.Colors[1] = factory.GetColor(0xFFE575);
|
||||
bcb.Colors[2] = factory.GetColor(0xF2CD66);
|
||||
|
||||
bcb.Positions = new float[3];
|
||||
bcb.Positions[0] = 0f;
|
||||
bcb.Positions[1] = .75f;
|
||||
bcb.Positions[2] = 1f;
|
||||
|
||||
bg.BackColorBlend = bcb;
|
||||
bg.GradientAngle = 0;
|
||||
|
||||
style.Background = bg;
|
||||
style.TextColor = factory.GetColor(0x444444);
|
||||
|
||||
bg = new Background();
|
||||
bcb = new BackColorBlend();
|
||||
|
||||
bcb.Colors = new Color[3];
|
||||
bcb.Colors[0] = Color.FromArgb(254 - 20, 240 - 20, 214 - 20);
|
||||
bcb.Colors[1] = Color.FromArgb(254 - 30, 199 - 30, 104 - 30);
|
||||
bcb.Colors[2] = Color.FromArgb(229 - 30, 133 - 30, 0);
|
||||
|
||||
bcb.Positions = new float[3];
|
||||
bcb.Positions[0] = 0f;
|
||||
bcb.Positions[1] = .75f;
|
||||
bcb.Positions[2] = 1f;
|
||||
|
||||
bg.BackColorBlend = bcb;
|
||||
bg.GradientAngle = 0;
|
||||
|
||||
style.ActiveRowBackground = bg;
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
return (rowStyle);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSelectedMouseOverRowStyle
|
||||
|
||||
private RowVisualStyle GetSelectedMouseOverRowStyle(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
RowVisualStyle rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = GetDefaultSelectedBackground(factory);
|
||||
|
||||
RowHeaderVisualStyle style = new RowHeaderVisualStyle();
|
||||
style.Background = new Background(factory.GetColor(0xBABABA));
|
||||
style.ActiveRowBackground = new Background(factory.GetColor(0xBABABA));
|
||||
style.TextColor = factory.GetColor(0x444444);
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
visualStyle.RowStyles[StyleType.Selected] = rowStyle;
|
||||
|
||||
rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = GetSelectedColumnMouseOverBackground(factory);
|
||||
|
||||
style = new RowHeaderVisualStyle();
|
||||
style.Background = new Background(factory.GetColor(0xFFEB91));
|
||||
style.ActiveRowBackground = new Background(factory.GetColor(0xB7DBFF));
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
return (rowStyle);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitGroupHeaderStyles
|
||||
|
||||
private void InitGroupHeaderStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
GroupHeaderVisualStyle style = new GroupHeaderVisualStyle();
|
||||
|
||||
style.AllowWrap = Tbool.True;
|
||||
style.Alignment = Alignment.MiddleLeft;
|
||||
style.Font = SystemFonts.DefaultFont;
|
||||
|
||||
style.Background = new
|
||||
Background(factory.GetColor(0xFFFFFF));
|
||||
|
||||
style.UnderlineColor = factory.GetColor(0x444444);
|
||||
|
||||
style.RowHeaderStyle.Background = new Background(factory.GetColor(0xBABABA));
|
||||
style.RowHeaderStyle.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
style.RowHeaderStyle.Font = SystemFonts.DefaultFont;
|
||||
|
||||
visualStyle.GroupHeaderStyles[StyleType.Default] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedColumnBackground
|
||||
private Background GetDefaultSelectedColumnBackground(ColorFactory factory)
|
||||
{
|
||||
return (new Background(factory.GetColor(0xFFD359), factory.GetColor(0xFFEF71)));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedBackground
|
||||
|
||||
private Background GetDefaultSelectedBackground(ColorFactory factory)
|
||||
{
|
||||
return (new Background(factory.GetColor(0xB7DBFF)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedColumnMouseOverStyle
|
||||
|
||||
private Background GetSelectedColumnMouseOverBackground(ColorFactory factory)
|
||||
{
|
||||
return (new Background(factory.GetColor(0xFFE063), factory.GetColor(0xFFF9A2)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedMouseOverStyle
|
||||
|
||||
private Background GetSelectedMouseOverBackground(ColorFactory factory)
|
||||
{
|
||||
return (new Background(factory.GetColor(0xB0D4F7)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitFilterColumnHeaderStyles
|
||||
|
||||
private void InitFilterColumnHeaderStyles(
|
||||
DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
FilterColumnHeaderVisualStyle colStyle = new FilterColumnHeaderVisualStyle();
|
||||
|
||||
colStyle.Alignment = Alignment.MiddleCenter;
|
||||
colStyle.Font = SystemFonts.CaptionFont;
|
||||
|
||||
colStyle.TextColor = factory.GetColor(0xE2E2E2);
|
||||
colStyle.ErrorTextColor = Color.Red;
|
||||
|
||||
colStyle.Background = new Background(factory.GetColor(0x6A6A6A));
|
||||
colStyle.GripBarBackground = new Background(factory.GetColor(0x797979));
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.Default] = colStyle;
|
||||
|
||||
colStyle = new FilterColumnHeaderVisualStyle();
|
||||
colStyle.Background = new Background(factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6));
|
||||
colStyle.TextColor = factory.GetColor(0x444444);
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.MouseOver] = colStyle;
|
||||
|
||||
colStyle = new FilterColumnHeaderVisualStyle();
|
||||
colStyle.Background = GetDefaultSelectedColumnBackground(factory);
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.Selected] = colStyle;
|
||||
|
||||
colStyle = new FilterColumnHeaderVisualStyle();
|
||||
colStyle.Background = GetSelectedColumnMouseOverBackground(factory);
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.SelectedMouseOver] = colStyle;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitFilterRowStyles
|
||||
|
||||
private void InitFilterRowStyles(
|
||||
DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
FilterRowVisualStyle style = new FilterRowVisualStyle();
|
||||
|
||||
style.FilterBorderColor = GetBorderHighlight(factory);
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(Color.LightGray), 0);
|
||||
|
||||
style.WhiteSpaceBackground = new Background(factory.GetColor(0x797979));
|
||||
|
||||
style.RowHeader.Background = new Background(factory.GetColor(0x6A6A6A),
|
||||
factory.GetColor(0x595959), BackFillType.ForwardDiagonal);
|
||||
|
||||
style.RowHeader.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
visualStyle.FilterRowStyles[StyleType.Default] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(Color.Green), 45);
|
||||
|
||||
visualStyle.FilterRowStyles[StyleType.Selected] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(0xE2AA00), 0);
|
||||
style.RowHeader.Background = new Background(factory.GetColor(0x8E8E8E));
|
||||
|
||||
visualStyle.FilterRowStyles[StyleType.MouseOver] = style;
|
||||
visualStyle.FilterRowStyles[StyleType.SelectedMouseOver] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitGroupByStyles
|
||||
|
||||
private void InitGroupByStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
GroupByVisualStyle style = new GroupByVisualStyle();
|
||||
|
||||
style.Alignment = Alignment.MiddleCenter;
|
||||
style.GroupBoxConnectorColor = factory.GetColor(0x313131); // Panel border color
|
||||
style.GroupBoxBorderColor = factory.GetColor(0x313131);
|
||||
|
||||
style.InsertMarkerBorderColor = factory.GetColor(0x313131);
|
||||
style.InsertMarkerBackground = new Background(factory.GetColor(Color.Red));
|
||||
|
||||
style.RowHeaderStyle.Background = new Background(factory.GetColor(0x6A6A6A), factory.GetColor(0x595959), BackFillType.ForwardDiagonal);
|
||||
style.RowHeaderStyle.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
style.TextColor = factory.GetColor(0x363636); // Col text color
|
||||
style.GroupBoxBackground = new Background(factory.GetColor(0x6A6A6A)); // col background
|
||||
visualStyle.GroupByStyles[StyleType.Default] = style;
|
||||
|
||||
style = new GroupByVisualStyle();
|
||||
style.GroupBoxBackground = new Background(factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6)); // col background
|
||||
visualStyle.GroupByStyles[StyleType.MouseOver] = style;
|
||||
|
||||
style = new GroupByVisualStyle();
|
||||
style.GroupBoxBackground = GetDefaultSelectedColumnBackground(factory); // col background
|
||||
visualStyle.GroupByStyles[StyleType.Selected] = style;
|
||||
|
||||
style = new GroupByVisualStyle();
|
||||
style.GroupBoxBackground = GetSelectedColumnMouseOverBackground(factory); // col background
|
||||
visualStyle.GroupByStyles[StyleType.SelectedMouseOver] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetBorderHighlight
|
||||
|
||||
private Color GetBorderHighlight(ColorFactory factory)
|
||||
{
|
||||
return factory.GetColor("10FFFFFF");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,593 @@
|
||||
using System.Drawing;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Create the Office 2010 Blue Visual Style for SuperGridControl.
|
||||
/// </summary>
|
||||
public class Office2010BlueStyleFactory : VisualStyleFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Create the DefaultVisualStyle for SuperGridControl.
|
||||
/// </summary>
|
||||
/// <param name="factory">Color-Factory used to generate colors.</param>
|
||||
/// <returns>New instance of DefaultVisualStyles class.</returns>s
|
||||
public override DefaultVisualStyles CreateStyle(ColorFactory factory)
|
||||
{
|
||||
DefaultVisualStyles visualStyle = new DefaultVisualStyles();
|
||||
|
||||
InitGridPanelStyle(visualStyle, factory);
|
||||
|
||||
InitCellStyles(visualStyle, factory);
|
||||
InitMergedCellStyles(visualStyle, factory);
|
||||
InitAltRowCellStyles(visualStyle, factory);
|
||||
|
||||
InitColumnStyles(visualStyle, factory);
|
||||
InitAltColumnStyles(visualStyle, factory);
|
||||
InitColumnHeaderStyles(visualStyle, factory);
|
||||
|
||||
InitRowStyles(visualStyle, factory);
|
||||
InitTextRowStyles(visualStyle, factory);
|
||||
|
||||
InitGroupHeaderStyles(visualStyle, factory);
|
||||
|
||||
InitFilterRowStyles(visualStyle, factory);
|
||||
InitFilterColumnHeaderStyles(visualStyle, factory);
|
||||
|
||||
InitGroupByStyles(visualStyle, factory);
|
||||
|
||||
return (visualStyle);
|
||||
}
|
||||
|
||||
#region InitGridPanelStyle
|
||||
|
||||
private void InitGridPanelStyle(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
GridPanelVisualStyle style = new GridPanelVisualStyle();
|
||||
|
||||
style.Background = new Background(factory.GetColor(0xFFFFFF));
|
||||
style.BorderColor = new BorderColor(factory.GetColor(0x849DBD));
|
||||
style.BorderPattern.All = LinePattern.Solid;
|
||||
style.BorderThickness = new Thickness(1);
|
||||
style.TextColor = factory.GetColor(0x000000);
|
||||
|
||||
style.TreeLineColor = factory.GetColor(0x484848);
|
||||
style.HeaderLineColor = factory.GetColor(0x849DBD);
|
||||
style.HorizontalLineColor = factory.GetColor(0xC4D9F6);
|
||||
style.VerticalLineColor = factory.GetColor(0xC4D9F6);
|
||||
|
||||
style.TreeLinePattern = LinePattern.Solid;
|
||||
style.HorizontalLinePattern = LinePattern.Solid;
|
||||
style.VerticalLinePattern = LinePattern.Solid;
|
||||
style.HeaderHLinePattern = LinePattern.Solid;
|
||||
style.HeaderVLinePattern = LinePattern.Solid;
|
||||
|
||||
BaseTreeButtonVisualStyle tstyle = new BaseTreeButtonVisualStyle();
|
||||
|
||||
tstyle.BorderColor = factory.GetColor(Color.SlateGray);
|
||||
tstyle.HotBorderColor = factory.GetColor(Color.SlateGray);
|
||||
tstyle.LineColor = factory.GetColor(Color.DarkSlateGray);
|
||||
tstyle.HotLineColor = factory.GetColor(Color.DarkSlateGray);
|
||||
tstyle.Background = new Background(factory.GetColor(Color.White), factory.GetColor(Color.Gainsboro), 90);
|
||||
tstyle.HotBackground = new Background(factory.GetColor(Color.White), factory.GetColor(Color.Gainsboro), 90);
|
||||
|
||||
style.CircleTreeButtonStyle.CollapseButton = tstyle;
|
||||
style.CircleTreeButtonStyle.ExpandButton = tstyle;
|
||||
|
||||
style.SquareTreeButtonStyle.CollapseButton = tstyle;
|
||||
style.SquareTreeButtonStyle.ExpandButton = tstyle;
|
||||
|
||||
tstyle = new BaseTreeButtonVisualStyle();
|
||||
|
||||
tstyle.BorderColor = factory.GetColor(Color.Black);
|
||||
tstyle.HotBorderColor = factory.GetColor(0x27C7F7);
|
||||
tstyle.Background = new Background(factory.GetColor(Color.Black));
|
||||
tstyle.HotBackground = new Background(factory.GetColor(0xC7EBFA));
|
||||
|
||||
style.TriangleTreeButtonStyle.CollapseButton = tstyle;
|
||||
|
||||
tstyle = new BaseTreeButtonVisualStyle();
|
||||
|
||||
tstyle.BorderColor = factory.GetColor(Color.DimGray);
|
||||
tstyle.HotBorderColor = factory.GetColor(0x27C7F7);
|
||||
tstyle.Background = new Background(factory.GetColor(Color.White));
|
||||
tstyle.HotBackground = new Background(factory.GetColor(0xC7EBFA));
|
||||
|
||||
style.TriangleTreeButtonStyle.ExpandButton = tstyle;
|
||||
|
||||
visualStyle.GridPanelStyle = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitColumnHeaderStyles
|
||||
|
||||
private void InitColumnHeaderStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
ColumnHeaderRowVisualStyle style = new ColumnHeaderRowVisualStyle();
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(0x697D96);
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(0x5B92FF), 0);
|
||||
|
||||
style.WhiteSpaceBackground = new Background(factory.GetColor(0xCFDDEE));
|
||||
|
||||
style.RowHeader.Background = new Background(
|
||||
factory.GetColor(0xEFF5FB), factory.GetColor(0xE2EDFA), BackFillType.ForwardDiagonal);
|
||||
|
||||
style.RowHeader.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
style.IndicatorBackground = new Background(factory.GetColor(0x4488E5));
|
||||
style.IndicatorBorderColor = factory.GetColor(0x1F48A1);
|
||||
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.Default] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(Color.Green);
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(Color.Green), 0);
|
||||
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.Selected] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(0x697D96);
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(0xE2AA00), 0);
|
||||
|
||||
style.RowHeader.Background = new Background(
|
||||
factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6), BackFillType.Angle);
|
||||
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.MouseOver] = style;
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.SelectedMouseOver] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitTextRowStyles
|
||||
|
||||
private void InitTextRowStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
TextRowVisualStyle style = new TextRowVisualStyle();
|
||||
|
||||
style.Alignment = Alignment.MiddleCenter;
|
||||
style.AllowWrap = Tbool.True;
|
||||
|
||||
style.Background = new Background(factory.GetColor(0xEFF5FB), factory.GetColor(0xE2ECFA), BackFillType.Angle);
|
||||
style.BorderColor = new BorderColor(factory.GetColor(0x849DBD));
|
||||
|
||||
style.Padding.All = 2;
|
||||
|
||||
style.TextColor = factory.GetColor(0x1E395B);
|
||||
|
||||
style.RowHeaderStyle.Background = new Background(factory.GetColor(0xEFF5FB), factory.GetColor(0xE2ECFA), BackFillType.Angle);
|
||||
style.RowHeaderStyle.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
visualStyle.TitleStyles[StyleType.Default] = style;
|
||||
visualStyle.HeaderStyles[StyleType.Default] = style.Copy();
|
||||
visualStyle.FooterStyles[StyleType.Default] = style.Copy();
|
||||
|
||||
style = style.Copy();
|
||||
style.Background = new Background(Color.Transparent);
|
||||
|
||||
visualStyle.CaptionStyles[StyleType.Default] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitCellStyles
|
||||
|
||||
private void InitCellStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
CellVisualStyle style = new CellVisualStyle();
|
||||
|
||||
style.Alignment = Alignment.MiddleLeft;
|
||||
style.Background = new Background(factory.GetColor(Color.White));
|
||||
style.BorderColor = new BorderColor(factory.GetColor(0xC4D9F6));
|
||||
style.BorderPattern.All = LinePattern.Solid;
|
||||
style.BorderThickness.All = 0;
|
||||
style.Font = SystemFonts.DefaultFont;
|
||||
style.ImageAlignment = Alignment.MiddleLeft;
|
||||
style.ImagePadding.All = 2;
|
||||
style.Margin.All = 0;
|
||||
style.ImageOverlay = ImageOverlay.None;
|
||||
style.Padding.All = 0;
|
||||
style.TextColor = Color.Black;
|
||||
|
||||
visualStyle.CellStyles[StyleType.Default] = style;
|
||||
|
||||
style = new CellVisualStyle();
|
||||
style.Background = GetDefaultSelectedBackground(factory);
|
||||
visualStyle.CellStyles[StyleType.Selected] = style;
|
||||
|
||||
style = new CellVisualStyle();
|
||||
style.Background = GetSelectedMouseOverBackground(factory);
|
||||
visualStyle.CellStyles[StyleType.SelectedMouseOver] = style;
|
||||
|
||||
style = new CellVisualStyle();
|
||||
style.Background = new Background(factory.GetColor(0xF1F8FF));
|
||||
visualStyle.CellStyles[StyleType.Empty] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitMergedCellStyles
|
||||
|
||||
private void InitMergedCellStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
visualStyle.MergedCellStyles[StyleType.Default] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.ReadOnly] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.Selected] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.ReadOnlySelected] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.SelectedMouseOver] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.ReadOnlySelectedMouseOver] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.Empty] = new CellVisualStyle();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitAltRowCellStyles
|
||||
|
||||
private void InitAltRowCellStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
visualStyle.AlternateRowCellStyles[StyleType.Default].Background =
|
||||
new Background(factory.GetColor(0xF4F4F4));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitColumnStyles
|
||||
|
||||
private void InitColumnStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
ColumnHeaderVisualStyle colStyle = new ColumnHeaderVisualStyle();
|
||||
|
||||
colStyle.Alignment = Alignment.MiddleCenter;
|
||||
colStyle.BorderColor = new BorderColor(factory.GetColor(0xA0B0C7));
|
||||
colStyle.BorderPattern.All = LinePattern.Solid;
|
||||
colStyle.BorderThickness.All = 0;
|
||||
colStyle.Font = SystemFonts.CaptionFont;
|
||||
colStyle.ImageAlignment = Alignment.MiddleLeft;
|
||||
colStyle.Margin.All = 0;
|
||||
colStyle.ImageOverlay = ImageOverlay.None;
|
||||
colStyle.TextColor = Color.Black;
|
||||
|
||||
colStyle.Background = new Background(factory.GetColor(0xEFF4FB), factory.GetColor(0xE1ECFA));
|
||||
visualStyle.ColumnHeaderStyles[StyleType.Default] = colStyle;
|
||||
|
||||
colStyle = new ColumnHeaderVisualStyle();
|
||||
colStyle.Background = new Background(factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6));
|
||||
visualStyle.ColumnHeaderStyles[StyleType.MouseOver] = colStyle;
|
||||
|
||||
colStyle = new ColumnHeaderVisualStyle();
|
||||
colStyle.Background = GetDefaultSelectedColumnBackground(factory);
|
||||
visualStyle.ColumnHeaderStyles[StyleType.Selected] = colStyle;
|
||||
|
||||
colStyle = new ColumnHeaderVisualStyle();
|
||||
colStyle.Background = GetSelectedColumnMouseOverBackground(factory);
|
||||
visualStyle.ColumnHeaderStyles[StyleType.SelectedMouseOver] = colStyle;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitAltColumnStyles
|
||||
|
||||
private void InitAltColumnStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
visualStyle.AlternateColumnCellStyles[StyleType.Default].Background =
|
||||
new Background(factory.GetColor(0xEAF2FB));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitRowStyles
|
||||
|
||||
private void InitRowStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
visualStyle.RowStyles[StyleType.Default] = GetDefaultRowStyle(factory);
|
||||
visualStyle.RowStyles[StyleType.MouseOver] = GetMouseOverRowStyle(factory);
|
||||
visualStyle.RowStyles[StyleType.SelectedMouseOver] = GetSelectedMouseOverRowStyle(visualStyle, factory);
|
||||
}
|
||||
|
||||
#region GetDefaultRowStyle
|
||||
|
||||
private RowVisualStyle GetDefaultRowStyle(ColorFactory factory)
|
||||
{
|
||||
RowVisualStyle rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = new Background(Color.White);
|
||||
|
||||
RowHeaderVisualStyle style = new RowHeaderVisualStyle();
|
||||
|
||||
style.Font = SystemFonts.DefaultFont;
|
||||
style.TextColor = factory.GetColor(0x1E395B);
|
||||
|
||||
Background bg = new Background();
|
||||
BackColorBlend bcb = new BackColorBlend();
|
||||
|
||||
bcb.Colors = new Color[3];
|
||||
bcb.Colors[0] = factory.GetColor(0xDAE7F5);
|
||||
bcb.Colors[1] = factory.GetColor(0xDAE7F5);
|
||||
bcb.Colors[2] = factory.GetColor(0xB4C6E0);
|
||||
|
||||
bcb.Positions = new float[3];
|
||||
bcb.Positions[0] = 0f;
|
||||
bcb.Positions[1] = .75f;
|
||||
bcb.Positions[2] = 1f;
|
||||
|
||||
bg.BackColorBlend = bcb;
|
||||
bg.GradientAngle = 0;
|
||||
|
||||
style.Background = bg;
|
||||
|
||||
bg = new Background(factory.GetColor(0xDAE7F5));
|
||||
|
||||
style.ActiveRowBackground = bg;
|
||||
style.DirtyMarkerBackground = new Background(factory.GetColor(0xAE054F), factory.GetColor(0xE75E94), BackFillType.VerticalCenter);
|
||||
style.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
return (rowStyle);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetMouseOverRowStyle
|
||||
|
||||
private RowVisualStyle GetMouseOverRowStyle(ColorFactory factory)
|
||||
{
|
||||
RowVisualStyle rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = new Background(Color.White);
|
||||
|
||||
RowHeaderVisualStyle style = new RowHeaderVisualStyle();
|
||||
style.Background = new Background(Color.Plum);
|
||||
style.ActiveRowBackground = new Background(Color.Blue);
|
||||
|
||||
Background bg = new Background();
|
||||
BackColorBlend bcb = new BackColorBlend();
|
||||
|
||||
bcb.Colors = new Color[3];
|
||||
bcb.Colors[0] = factory.GetColor(0xFFE575);
|
||||
bcb.Colors[1] = factory.GetColor(0xFFE575);
|
||||
bcb.Colors[2] = factory.GetColor(0xF2CD66);
|
||||
|
||||
bcb.Positions = new float[3];
|
||||
bcb.Positions[0] = 0f;
|
||||
bcb.Positions[1] = .75f;
|
||||
bcb.Positions[2] = 1f;
|
||||
|
||||
bg.BackColorBlend = bcb;
|
||||
bg.GradientAngle = 0;
|
||||
|
||||
style.Background = bg;
|
||||
|
||||
bg = new Background();
|
||||
bcb = new BackColorBlend();
|
||||
|
||||
bcb.Colors = new Color[3];
|
||||
bcb.Colors[0] = Color.FromArgb(254 - 20, 240 - 20, 214 - 20);
|
||||
bcb.Colors[1] = Color.FromArgb(254 - 30, 199 - 30, 104 - 30);
|
||||
bcb.Colors[2] = Color.FromArgb(229 - 30, 133 - 30, 0);
|
||||
|
||||
bcb.Positions = new float[3];
|
||||
bcb.Positions[0] = 0f;
|
||||
bcb.Positions[1] = .75f;
|
||||
bcb.Positions[2] = 1f;
|
||||
|
||||
bg.BackColorBlend = bcb;
|
||||
bg.GradientAngle = 0;
|
||||
|
||||
style.ActiveRowBackground = bg;
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
return (rowStyle);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSelectedMouseOverRowStyle
|
||||
|
||||
private RowVisualStyle GetSelectedMouseOverRowStyle(
|
||||
DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
RowVisualStyle rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = GetDefaultSelectedBackground(factory);
|
||||
|
||||
RowHeaderVisualStyle style = new RowHeaderVisualStyle();
|
||||
style.Background = new Background(factory.GetColor(0xC7CED6));
|
||||
style.ActiveRowBackground = new Background(factory.GetColor(0xC7CED6));
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
visualStyle.RowStyles[StyleType.Selected] = rowStyle;
|
||||
|
||||
rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = GetSelectedColumnMouseOverBackground(factory);
|
||||
|
||||
style = new RowHeaderVisualStyle();
|
||||
style.Background = new Background(factory.GetColor(0xC7CED6));
|
||||
style.ActiveRowBackground = new Background(factory.GetColor(0xC7CED6));
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
return (rowStyle);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitGroupHeaderStyles
|
||||
|
||||
private void InitGroupHeaderStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
GroupHeaderVisualStyle style = new GroupHeaderVisualStyle();
|
||||
|
||||
style.AllowWrap = Tbool.True;
|
||||
style.Alignment = Alignment.MiddleLeft;
|
||||
style.Font = SystemFonts.DefaultFont;
|
||||
|
||||
style.Background = new
|
||||
Background(factory.GetColor(0xFFFFFF));
|
||||
|
||||
style.UnderlineColor = factory.GetColor(0xC4D9F6);
|
||||
|
||||
style.RowHeaderStyle.Background = new Background(factory.GetColor(0xE3EDFA));
|
||||
style.RowHeaderStyle.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
style.RowHeaderStyle.Font = SystemFonts.DefaultFont;
|
||||
|
||||
visualStyle.GroupHeaderStyles[StyleType.Default] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedColumnBackground
|
||||
private Background GetDefaultSelectedColumnBackground(ColorFactory factory)
|
||||
{
|
||||
Background bg = new Background(factory.GetColor(0xFFD359), factory.GetColor(0xFFEF71));
|
||||
return bg;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedBackground
|
||||
|
||||
private Background GetDefaultSelectedBackground(ColorFactory factory)
|
||||
{
|
||||
return (new Background(factory.GetColor(0xB0D4F7)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedColumnMouseOverStyle
|
||||
|
||||
private Background GetSelectedColumnMouseOverBackground(ColorFactory factory)
|
||||
{
|
||||
return (new Background(factory.GetColor(0xFFE063), factory.GetColor(0xFFF9A2)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedMouseOverStyle
|
||||
|
||||
private Background GetSelectedMouseOverBackground(ColorFactory factory)
|
||||
{
|
||||
return (new Background(factory.GetColor(0xB0D4F7)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitFilterColumnHeaderStyles
|
||||
|
||||
private void InitFilterColumnHeaderStyles(
|
||||
DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
FilterColumnHeaderVisualStyle style = new FilterColumnHeaderVisualStyle();
|
||||
|
||||
style.Alignment = Alignment.MiddleLeft;
|
||||
style.Font = SystemFonts.CaptionFont;
|
||||
|
||||
style.TextColor = Color.Black;
|
||||
style.ErrorTextColor = Color.Red;
|
||||
|
||||
style.Background = new Background(factory.GetColor(0xEFF4FB), factory.GetColor(0xE1ECFA));
|
||||
style.GripBarBackground = new Background(factory.GetColor(0xCFDDEE));
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.Default] = style;
|
||||
|
||||
style = new FilterColumnHeaderVisualStyle();
|
||||
style.Background = new Background(factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6));
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.MouseOver] = style;
|
||||
|
||||
style = new FilterColumnHeaderVisualStyle();
|
||||
style.Background = GetDefaultSelectedColumnBackground(factory);
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.Selected] = style;
|
||||
|
||||
style = new FilterColumnHeaderVisualStyle();
|
||||
style.Background = GetSelectedColumnMouseOverBackground(factory);
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.SelectedMouseOver] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitFilterRowStyles
|
||||
|
||||
private void InitFilterRowStyles(
|
||||
DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
FilterRowVisualStyle style = new FilterRowVisualStyle();
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(0x697D96);
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(0x4168B6), 0);
|
||||
|
||||
style.WhiteSpaceBackground = new Background(factory.GetColor(0xCFDDEE));
|
||||
|
||||
style.RowHeader.Background = new Background(factory.GetColor(0xEFF5FB),
|
||||
factory.GetColor(0xE2EDFA), BackFillType.ForwardDiagonal);
|
||||
|
||||
style.RowHeader.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
visualStyle.FilterRowStyles[StyleType.Default] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(Color.Green), 0);
|
||||
|
||||
visualStyle.FilterRowStyles[StyleType.Selected] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(0xE2AA00), 0);
|
||||
|
||||
style.RowHeader.Background = new
|
||||
Background(factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6), BackFillType.Angle);
|
||||
|
||||
visualStyle.FilterRowStyles[StyleType.MouseOver] = style;
|
||||
visualStyle.FilterRowStyles[StyleType.SelectedMouseOver] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitGroupByStyles
|
||||
|
||||
private void InitGroupByStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
GroupByVisualStyle style = new GroupByVisualStyle();
|
||||
|
||||
style.Alignment = Alignment.MiddleCenter;
|
||||
style.GroupBoxConnectorColor = factory.GetColor(0x849DBD); // Panel border color
|
||||
style.GroupBoxBorderColor = factory.GetColor(0x849DBD);
|
||||
|
||||
style.InsertMarkerBorderColor = factory.GetColor(0x849DBD);
|
||||
style.InsertMarkerBackground = new Background(factory.GetColor(Color.Red));
|
||||
|
||||
style.RowHeaderStyle.Background = new Background(factory.GetColor(0xEFF5FB), factory.GetColor(0xE2EDFA), BackFillType.ForwardDiagonal);
|
||||
style.RowHeaderStyle.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
style.TextColor = factory.GetColor(0x363636); // Col text color
|
||||
style.GroupBoxBackground = new Background(factory.GetColor(0xEFF4FB), factory.GetColor(0xE1ECFA)); // col background
|
||||
visualStyle.GroupByStyles[StyleType.Default] = style;
|
||||
|
||||
style = new GroupByVisualStyle();
|
||||
style.GroupBoxBackground = new Background(factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6)); // col background
|
||||
visualStyle.GroupByStyles[StyleType.MouseOver] = style;
|
||||
|
||||
style = new GroupByVisualStyle();
|
||||
style.GroupBoxBackground = GetDefaultSelectedColumnBackground(factory); // col background
|
||||
visualStyle.GroupByStyles[StyleType.Selected] = style;
|
||||
|
||||
style = new GroupByVisualStyle();
|
||||
style.GroupBoxBackground = GetSelectedColumnMouseOverBackground(factory); // col background
|
||||
visualStyle.GroupByStyles[StyleType.SelectedMouseOver] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetBorderHighlight
|
||||
|
||||
private Color GetBorderHighlight(ColorFactory factory)
|
||||
{
|
||||
return factory.GetColor("80FFFFFF");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,598 @@
|
||||
using System.Drawing;
|
||||
using DevComponents.DotNetBar.Rendering;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Create the Office 2010 Silver Visual Style for SuperGridControl.
|
||||
/// </summary>
|
||||
public class Office2010SilverStyleFactory : VisualStyleFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Create the DefaultVisualStyle for SuperGridControl.
|
||||
/// </summary>
|
||||
/// <param name="factory">Color-Factory used to generate colors.</param>
|
||||
/// <returns>New instance of DefaultVisualStyles class.</returns>s
|
||||
public override DefaultVisualStyles CreateStyle(ColorFactory factory)
|
||||
{
|
||||
DefaultVisualStyles visualStyle = new DefaultVisualStyles();
|
||||
|
||||
InitGridPanelStyle(visualStyle, factory);
|
||||
|
||||
InitCellStyles(visualStyle, factory);
|
||||
InitMergedCellStyles(visualStyle, factory);
|
||||
InitAltRowCellStyles(visualStyle, factory);
|
||||
|
||||
InitColumnStyles(visualStyle, factory);
|
||||
InitAltColumnStyles(visualStyle, factory);
|
||||
InitColumnHeaderStyles(visualStyle, factory);
|
||||
|
||||
InitRowStyles(visualStyle, factory);
|
||||
InitTextRowStyles(visualStyle, factory);
|
||||
|
||||
InitGroupHeaderStyles(visualStyle, factory);
|
||||
|
||||
InitFilterRowStyles(visualStyle, factory);
|
||||
InitFilterColumnHeaderStyles(visualStyle, factory);
|
||||
|
||||
InitGroupByStyles(visualStyle, factory);
|
||||
|
||||
return (visualStyle);
|
||||
}
|
||||
|
||||
#region InitGridPanelStyle
|
||||
|
||||
private void InitGridPanelStyle(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
GridPanelVisualStyle style = new GridPanelVisualStyle();
|
||||
|
||||
style.Background = new Background(factory.GetColor(0xFFFFFF));
|
||||
style.BorderColor = new BorderColor(factory.GetColor(0x8B9097));
|
||||
style.BorderPattern.All = LinePattern.Solid;
|
||||
style.BorderThickness = new Thickness(1);
|
||||
style.TextColor = factory.GetColor(0x000000);
|
||||
|
||||
style.TreeLineColor = factory.GetColor(0x484848);
|
||||
style.HeaderLineColor = factory.GetColor(0x8B9097);
|
||||
style.HorizontalLineColor = factory.GetColor(0xDBDEE1);
|
||||
style.VerticalLineColor = factory.GetColor(0xDBDEE1);
|
||||
|
||||
style.TreeLinePattern = LinePattern.Solid;
|
||||
style.HorizontalLinePattern = LinePattern.Solid;
|
||||
style.VerticalLinePattern = LinePattern.Solid;
|
||||
style.HeaderHLinePattern = LinePattern.Solid;
|
||||
style.HeaderVLinePattern = LinePattern.Solid;
|
||||
|
||||
BaseTreeButtonVisualStyle tstyle = new BaseTreeButtonVisualStyle();
|
||||
|
||||
tstyle.BorderColor = factory.GetColor(Color.SlateGray);
|
||||
tstyle.HotBorderColor = factory.GetColor(Color.SlateGray);
|
||||
tstyle.LineColor = factory.GetColor(Color.DarkSlateGray);
|
||||
tstyle.HotLineColor = factory.GetColor(Color.DarkSlateGray);
|
||||
tstyle.Background = new Background(factory.GetColor(Color.White), factory.GetColor(Color.Gainsboro), 90);
|
||||
tstyle.HotBackground = new Background(factory.GetColor(Color.White), factory.GetColor(Color.Gainsboro), 90);
|
||||
|
||||
style.CircleTreeButtonStyle.CollapseButton = tstyle;
|
||||
style.CircleTreeButtonStyle.ExpandButton = tstyle;
|
||||
|
||||
style.SquareTreeButtonStyle.CollapseButton = tstyle;
|
||||
style.SquareTreeButtonStyle.ExpandButton = tstyle;
|
||||
|
||||
tstyle = new BaseTreeButtonVisualStyle();
|
||||
|
||||
tstyle.BorderColor = factory.GetColor(Color.Black);
|
||||
tstyle.HotBorderColor = factory.GetColor(0x27C7F7);
|
||||
tstyle.Background = new Background(factory.GetColor(Color.Black));
|
||||
tstyle.HotBackground = new Background(factory.GetColor(0xC7EBFA));
|
||||
|
||||
style.TriangleTreeButtonStyle.CollapseButton = tstyle;
|
||||
|
||||
tstyle = new BaseTreeButtonVisualStyle();
|
||||
|
||||
tstyle.BorderColor = factory.GetColor(Color.DimGray);
|
||||
tstyle.HotBorderColor = factory.GetColor(0x27C7F7);
|
||||
tstyle.Background = new Background(factory.GetColor(Color.White));
|
||||
tstyle.HotBackground = new Background(factory.GetColor(0xC7EBFA));
|
||||
|
||||
style.TriangleTreeButtonStyle.ExpandButton = tstyle;
|
||||
visualStyle.GridPanelStyle = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitColumnHeaderStyles
|
||||
|
||||
private void InitColumnHeaderStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
ColumnHeaderRowVisualStyle style = new ColumnHeaderRowVisualStyle();
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(0x787D87);
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(0xB0B6BC), 0);
|
||||
|
||||
style.WhiteSpaceBackground = new Background(factory.GetColor(0xE9EDF1));
|
||||
|
||||
style.RowHeader.Background = new Background(
|
||||
factory.GetColor(0xF5F7F9), factory.GetColor(0xEFF2F6), BackFillType.ForwardDiagonal);
|
||||
|
||||
style.RowHeader.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
style.IndicatorBackground = new Background(factory.GetColor(0xB0B6BC));
|
||||
style.IndicatorBorderColor = factory.GetColor(0x787D87);
|
||||
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.Default] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(Color.Green);
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(Color.Green), 45);
|
||||
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.Selected] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(0x797979);
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(0xE2AA00), 0);
|
||||
|
||||
style.RowHeader.Background = new Background(
|
||||
factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6), BackFillType.Angle);
|
||||
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.MouseOver] = style;
|
||||
visualStyle.ColumnHeaderRowStyles[StyleType.SelectedMouseOver] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitTextRowStyles
|
||||
|
||||
private void InitTextRowStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
TextRowVisualStyle style = new TextRowVisualStyle();
|
||||
|
||||
style.Alignment = Alignment.MiddleCenter;
|
||||
style.AllowWrap = Tbool.True;
|
||||
|
||||
style.Background = new Background(factory.GetColor(0xF5F7F9), factory.GetColor(0xEFF2F6), BackFillType.Angle);
|
||||
style.BorderColor = new BorderColor(factory.GetColor(0xA5ACB5));
|
||||
|
||||
style.Padding.All = 2;
|
||||
|
||||
style.TextColor = factory.GetColor(0x3B3B3B);
|
||||
|
||||
style.RowHeaderStyle.Background = new Background(factory.GetColor(0xF5F7F9), factory.GetColor(0xEFF2F6), BackFillType.Angle);
|
||||
style.RowHeaderStyle.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
visualStyle.TitleStyles[StyleType.Default] = style;
|
||||
visualStyle.HeaderStyles[StyleType.Default] = style.Copy();
|
||||
visualStyle.FooterStyles[StyleType.Default] = style.Copy();
|
||||
|
||||
style = style.Copy();
|
||||
style.Background = new Background(factory.GetColor(0xE9EDF1));
|
||||
|
||||
visualStyle.CaptionStyles[StyleType.Default] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitCellStyles
|
||||
|
||||
private void InitCellStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
CellVisualStyle style = new CellVisualStyle();
|
||||
|
||||
style.Alignment = Alignment.MiddleLeft;
|
||||
style.Background = new Background(factory.GetColor(Color.White));
|
||||
style.BorderColor = new BorderColor(factory.GetColor(0xDBDEE1));
|
||||
style.BorderPattern.All = LinePattern.Solid;
|
||||
style.BorderThickness.All = 0;
|
||||
style.Font = SystemFonts.DefaultFont;
|
||||
style.ImageAlignment = Alignment.MiddleLeft;
|
||||
style.ImagePadding.All = 2;
|
||||
style.Margin.All = 0;
|
||||
style.ImageOverlay = ImageOverlay.None;
|
||||
style.Padding.All = 0;
|
||||
style.TextColor = Color.Black;
|
||||
|
||||
visualStyle.CellStyles[StyleType.Default] = style;
|
||||
|
||||
style = new CellVisualStyle();
|
||||
style.Background = GetDefaultSelectedBackground(factory);
|
||||
|
||||
visualStyle.CellStyles[StyleType.Selected] = style;
|
||||
|
||||
style = new CellVisualStyle();
|
||||
style.Background = GetSelectedMouseOverBackground(factory);
|
||||
|
||||
visualStyle.CellStyles[StyleType.SelectedMouseOver] = style;
|
||||
|
||||
style = new CellVisualStyle();
|
||||
style.Background = new Background(factory.GetColor(0xE9EDF1));
|
||||
|
||||
visualStyle.CellStyles[StyleType.Empty] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitMergedCellStyles
|
||||
|
||||
private void InitMergedCellStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
visualStyle.MergedCellStyles[StyleType.Default] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.ReadOnly] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.Selected] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.ReadOnlySelected] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.SelectedMouseOver] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.ReadOnlySelectedMouseOver] = new CellVisualStyle();
|
||||
visualStyle.MergedCellStyles[StyleType.Empty] = new CellVisualStyle();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitAltRowCellStyles
|
||||
|
||||
private void InitAltRowCellStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
visualStyle.AlternateRowCellStyles[StyleType.Default].Background =
|
||||
new Background(factory.GetColor(0xF4F4F4));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitColumnStyles
|
||||
|
||||
private void InitColumnStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
ColumnHeaderVisualStyle colStyle = new ColumnHeaderVisualStyle();
|
||||
|
||||
colStyle.Alignment = Alignment.MiddleCenter;
|
||||
colStyle.BorderColor = new BorderColor(factory.GetColor(Color.Transparent));
|
||||
colStyle.BorderPattern.All = LinePattern.Solid;
|
||||
colStyle.BorderThickness.All = 0;
|
||||
colStyle.Font = SystemFonts.CaptionFont;
|
||||
colStyle.ImageAlignment = Alignment.MiddleLeft;
|
||||
colStyle.Margin.All = 0;
|
||||
colStyle.ImageOverlay = ImageOverlay.None;
|
||||
colStyle.TextColor = factory.GetColor(0x363636);
|
||||
|
||||
colStyle.Background = new Background(factory.GetColor(0xF5F7F9), factory.GetColor(0xEFF2F6));
|
||||
|
||||
visualStyle.ColumnHeaderStyles[StyleType.Default] = colStyle;
|
||||
|
||||
colStyle = new ColumnHeaderVisualStyle();
|
||||
|
||||
colStyle.Background = new Background(factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6));
|
||||
|
||||
visualStyle.ColumnHeaderStyles[StyleType.MouseOver] = colStyle;
|
||||
|
||||
colStyle = new ColumnHeaderVisualStyle();
|
||||
colStyle.Background = GetDefaultSelectedColumnBackground(factory);
|
||||
|
||||
visualStyle.ColumnHeaderStyles[StyleType.Selected] = colStyle;
|
||||
|
||||
colStyle = new ColumnHeaderVisualStyle();
|
||||
colStyle.Background = GetSelectedColumnMouseOverBackground(factory);
|
||||
|
||||
visualStyle.ColumnHeaderStyles[StyleType.SelectedMouseOver] = colStyle;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitAltColumnStyles
|
||||
|
||||
private void InitAltColumnStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
visualStyle.AlternateColumnCellStyles[StyleType.Default].Background =
|
||||
new Background(factory.GetColor(0xF7F7FF));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitRowStyles
|
||||
|
||||
private void InitRowStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
visualStyle.RowStyles[StyleType.Default] = GetDefaultRowStyle(factory);
|
||||
visualStyle.RowStyles[StyleType.MouseOver] = GetMouseOverRowStyle(factory);
|
||||
visualStyle.RowStyles[StyleType.SelectedMouseOver] = GetSelectedMouseOverRowStyle(visualStyle, factory);
|
||||
}
|
||||
|
||||
#region GetDefaultRowStyle
|
||||
|
||||
private RowVisualStyle GetDefaultRowStyle(ColorFactory factory)
|
||||
{
|
||||
RowVisualStyle rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = new Background(Color.White);
|
||||
|
||||
RowHeaderVisualStyle style = new RowHeaderVisualStyle();
|
||||
|
||||
style.Font = SystemFonts.DefaultFont;
|
||||
style.TextColor = factory.GetColor(0x363636);
|
||||
|
||||
Background bg = new Background();
|
||||
BackColorBlend bcb = new BackColorBlend();
|
||||
|
||||
bcb.Colors = new Color[3];
|
||||
bcb.Colors[0] = factory.GetColor(0xDFE3E8);
|
||||
bcb.Colors[1] = factory.GetColor(0xDFE3E8);
|
||||
bcb.Colors[2] = factory.GetColor(0xC6CACF);
|
||||
|
||||
bcb.Positions = new float[3];
|
||||
bcb.Positions[0] = 0f;
|
||||
bcb.Positions[1] = .75f;
|
||||
bcb.Positions[2] = 1f;
|
||||
|
||||
bg.BackColorBlend = bcb;
|
||||
bg.GradientAngle = 0;
|
||||
|
||||
style.Background = bg;
|
||||
|
||||
bg = new Background(factory.GetColor(0xDFE3E8));
|
||||
|
||||
style.ActiveRowBackground = bg;
|
||||
style.DirtyMarkerBackground = new Background(factory.GetColor(0xAE054F), factory.GetColor(0xE75E94), BackFillType.VerticalCenter);
|
||||
style.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
return (rowStyle);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetMouseOverRowStyle
|
||||
|
||||
private RowVisualStyle GetMouseOverRowStyle(ColorFactory factory)
|
||||
{
|
||||
RowVisualStyle rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = new Background(Color.White);
|
||||
|
||||
RowHeaderVisualStyle style = new RowHeaderVisualStyle();
|
||||
style.Background = new Background(Color.Plum);
|
||||
style.ActiveRowBackground = new Background(Color.Blue);
|
||||
|
||||
Background bg = new Background();
|
||||
BackColorBlend bcb = new BackColorBlend();
|
||||
|
||||
bcb.Colors = new Color[3];
|
||||
bcb.Colors[0] = factory.GetColor(0xFFE575);
|
||||
bcb.Colors[1] = factory.GetColor(0xFFE575);
|
||||
bcb.Colors[2] = factory.GetColor(0xF2CD66);
|
||||
|
||||
bcb.Positions = new float[3];
|
||||
bcb.Positions[0] = 0f;
|
||||
bcb.Positions[1] = .75f;
|
||||
bcb.Positions[2] = 1f;
|
||||
|
||||
bg.BackColorBlend = bcb;
|
||||
bg.GradientAngle = 0;
|
||||
|
||||
style.Background = bg;
|
||||
|
||||
bg = new Background();
|
||||
bcb = new BackColorBlend();
|
||||
|
||||
bcb.Colors = new Color[3];
|
||||
bcb.Colors[0] = Color.FromArgb(254 - 20, 240 - 20, 214 - 20);
|
||||
bcb.Colors[1] = Color.FromArgb(254 - 30, 199 - 30, 104 - 30);
|
||||
bcb.Colors[2] = Color.FromArgb(229 - 30, 133 - 30, 0);
|
||||
|
||||
bcb.Positions = new float[3];
|
||||
bcb.Positions[0] = 0f;
|
||||
bcb.Positions[1] = .75f;
|
||||
bcb.Positions[2] = 1f;
|
||||
|
||||
bg.BackColorBlend = bcb;
|
||||
bg.GradientAngle = 0;
|
||||
|
||||
style.ActiveRowBackground = bg;
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
return (rowStyle);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSelectedMouseOverRowStyle
|
||||
|
||||
private RowVisualStyle GetSelectedMouseOverRowStyle(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
RowVisualStyle rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = GetDefaultSelectedBackground(factory);
|
||||
|
||||
RowHeaderVisualStyle style = new RowHeaderVisualStyle();
|
||||
style.Background = new Background(factory.GetColor(0xAAAAAA));
|
||||
style.ActiveRowBackground = new Background(factory.GetColor(0xAAAAAA));
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
visualStyle.RowStyles[StyleType.Selected] = rowStyle;
|
||||
|
||||
rowStyle = new RowVisualStyle();
|
||||
rowStyle.Background = GetSelectedColumnMouseOverBackground(factory);
|
||||
|
||||
style = new RowHeaderVisualStyle();
|
||||
style.Background = new Background(factory.GetColor(0xAAAAAA));
|
||||
style.ActiveRowBackground = new Background(factory.GetColor(0xAAAAAA));
|
||||
|
||||
rowStyle.RowHeaderStyle = style;
|
||||
|
||||
return (rowStyle);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitGroupHeaderStyles
|
||||
|
||||
private void InitGroupHeaderStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
GroupHeaderVisualStyle style = new GroupHeaderVisualStyle();
|
||||
|
||||
style.AllowWrap = Tbool.True;
|
||||
style.Alignment = Alignment.MiddleLeft;
|
||||
style.Font = SystemFonts.DefaultFont;
|
||||
|
||||
style.Background = new
|
||||
Background(factory.GetColor(0xE5E7E9));
|
||||
|
||||
style.UnderlineColor = factory.GetColor(0xE5E7E9);
|
||||
|
||||
style.RowHeaderStyle.Background = new Background(factory.GetColor(0xDFE3E8));
|
||||
style.RowHeaderStyle.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
style.RowHeaderStyle.Font = SystemFonts.DefaultFont;
|
||||
|
||||
visualStyle.GroupHeaderStyles[StyleType.Default] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedColumnBackground
|
||||
private Background GetDefaultSelectedColumnBackground(ColorFactory factory)
|
||||
{
|
||||
return (new Background(factory.GetColor(0xFFD359), factory.GetColor(0xFFEF71)));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedBackground
|
||||
|
||||
private Background GetDefaultSelectedBackground(ColorFactory factory)
|
||||
{
|
||||
return (new Background(factory.GetColor(0xB7DBFF)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedColumnMouseOverStyle
|
||||
|
||||
private Background GetSelectedColumnMouseOverBackground(ColorFactory factory)
|
||||
{
|
||||
return (new Background(factory.GetColor(0xB0D4F7)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetDefaultSelectedMouseOverStyle
|
||||
|
||||
private Background GetSelectedMouseOverBackground(ColorFactory factory)
|
||||
{
|
||||
return (new Background(factory.GetColor(0xB0D4F7)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitFilterColumnHeaderStyles
|
||||
|
||||
private void InitFilterColumnHeaderStyles(
|
||||
DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
FilterColumnHeaderVisualStyle colStyle = new FilterColumnHeaderVisualStyle();
|
||||
|
||||
colStyle.Alignment = Alignment.MiddleLeft;
|
||||
colStyle.Font = SystemFonts.CaptionFont;
|
||||
|
||||
colStyle.TextColor = factory.GetColor(0x363636);
|
||||
colStyle.ErrorTextColor = Color.Red;
|
||||
|
||||
colStyle.Background = new Background(factory.GetColor(0xF5F7F9), factory.GetColor(0xEFF2F6));
|
||||
colStyle.GripBarBackground = new Background(factory.GetColor(0xE9EDF1));
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.Default] = colStyle;
|
||||
|
||||
colStyle = new FilterColumnHeaderVisualStyle();
|
||||
colStyle.Background = new Background(factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6));
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.MouseOver] = colStyle;
|
||||
|
||||
colStyle = new FilterColumnHeaderVisualStyle();
|
||||
colStyle.Background = GetDefaultSelectedColumnBackground(factory);
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.Selected] = colStyle;
|
||||
|
||||
colStyle = new FilterColumnHeaderVisualStyle();
|
||||
colStyle.Background = GetSelectedColumnMouseOverBackground(factory);
|
||||
visualStyle.FilterColumnHeaderStyles[StyleType.SelectedMouseOver] = colStyle;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitFilterRowStyles
|
||||
|
||||
private void InitFilterRowStyles(
|
||||
DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
FilterRowVisualStyle style = new FilterRowVisualStyle();
|
||||
|
||||
style.FilterBorderColor = factory.GetColor(0x787D87);
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(0xB0B6BC), 0);
|
||||
|
||||
style.WhiteSpaceBackground = new Background(factory.GetColor(0xE9EDF1));
|
||||
|
||||
style.RowHeader.Background = new Background(
|
||||
factory.GetColor(0xF5F7F9), factory.GetColor(0xEFF2F6), BackFillType.ForwardDiagonal);
|
||||
|
||||
style.RowHeader.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
visualStyle.FilterRowStyles[StyleType.Default] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(Color.Green), 45);
|
||||
|
||||
visualStyle.FilterRowStyles[StyleType.Selected] = style;
|
||||
|
||||
style = style.Copy();
|
||||
|
||||
style.FilterBackground = new Background(Color.White, factory.GetColor(0xE2AA00), 0);
|
||||
|
||||
style.RowHeader.Background = new Background(
|
||||
factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6), BackFillType.Angle);
|
||||
|
||||
visualStyle.FilterRowStyles[StyleType.MouseOver] = style;
|
||||
visualStyle.FilterRowStyles[StyleType.SelectedMouseOver] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InitGroupByStyles
|
||||
|
||||
private void InitGroupByStyles(DefaultVisualStyles visualStyle, ColorFactory factory)
|
||||
{
|
||||
GroupByVisualStyle style = new GroupByVisualStyle();
|
||||
|
||||
style.Alignment = Alignment.MiddleCenter;
|
||||
style.GroupBoxConnectorColor = factory.GetColor(0x8B9097); // Panel border color
|
||||
style.GroupBoxBorderColor = factory.GetColor(0x8B9097);
|
||||
|
||||
style.InsertMarkerBorderColor = factory.GetColor(0x8B9097);
|
||||
style.InsertMarkerBackground = new Background(factory.GetColor(Color.Red));
|
||||
|
||||
style.RowHeaderStyle.Background = new Background(factory.GetColor(0xF5F7F9), factory.GetColor(0xEFF2F6), BackFillType.ForwardDiagonal);
|
||||
style.RowHeaderStyle.BorderHighlightColor = GetBorderHighlight(factory);
|
||||
|
||||
style.TextColor = factory.GetColor(0x363636); // Col text color
|
||||
style.GroupBoxBackground = new Background(factory.GetColor(0xF5F7F9), factory.GetColor(0xEFF2F6)); // col background
|
||||
visualStyle.GroupByStyles[StyleType.Default] = style;
|
||||
|
||||
style = new GroupByVisualStyle();
|
||||
style.GroupBoxBackground = new Background(factory.GetColor(0xFFDF6B), factory.GetColor(0xFFFCE6)); // col background
|
||||
visualStyle.GroupByStyles[StyleType.MouseOver] = style;
|
||||
|
||||
style = new GroupByVisualStyle();
|
||||
style.GroupBoxBackground = GetDefaultSelectedColumnBackground(factory); // col background
|
||||
visualStyle.GroupByStyles[StyleType.Selected] = style;
|
||||
|
||||
style = new GroupByVisualStyle();
|
||||
style.GroupBoxBackground = GetSelectedColumnMouseOverBackground(factory); // col background
|
||||
visualStyle.GroupByStyles[StyleType.SelectedMouseOver] = style;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetBorderHighlight
|
||||
|
||||
private Color GetBorderHighlight(ColorFactory factory)
|
||||
{
|
||||
return factory.GetColor("80FFFFFF");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents base class that each visual style factory for SuperGridControl inherits from.
|
||||
/// </summary>
|
||||
public abstract class VisualStyleFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Create the DefaultVisualStyle for SuperGridControl.
|
||||
/// </summary>
|
||||
/// <param name="factory">Color-Factory used to generate colors.</param>
|
||||
/// <returns>New instance of DefaultVisualStyles class.</returns>
|
||||
public abstract DefaultVisualStyles CreateStyle(Rendering.ColorFactory factory);
|
||||
|
||||
/// <summary>
|
||||
/// Create the DefaultVisualStyle for SuperGridControl with empty color factory.
|
||||
/// </summary>
|
||||
/// <returns>New instance of DefaultVisualStyles class.</returns>
|
||||
public virtual DefaultVisualStyles CreateStyle()
|
||||
{
|
||||
if (StyleManager.ColorTint.IsEmpty)
|
||||
return CreateStyle(Rendering.ColorFactory.Empty);
|
||||
|
||||
return CreateStyle(new Rendering.ColorBlendFactory(StyleManager.ColorTint));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the style factory for specified visual style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to create factory for.</param>
|
||||
/// <returns>An instance of VisualStyleFactory.</returns>
|
||||
public static VisualStyleFactory GetStyleFactory(SuperGridStyle style)
|
||||
{
|
||||
if (style == SuperGridStyle.Office2010Blue)
|
||||
return new Office2010BlueStyleFactory();
|
||||
|
||||
if (style == SuperGridStyle.Office2010Silver)
|
||||
return new Office2010SilverStyleFactory();
|
||||
|
||||
if (style == SuperGridStyle.Office2010Black)
|
||||
return new Office2010BlackStyleFactory();
|
||||
|
||||
if (style == SuperGridStyle.Metro)
|
||||
return new MetroStyleFactory();
|
||||
|
||||
throw new ArgumentException(string.Format(
|
||||
"Specified style '{0}' factory has not been implemented.", style));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DevComponents.DotNetBar.SuperGrid.Style
|
||||
{
|
||||
///<summary>
|
||||
/// VisualStylesTable
|
||||
///</summary>
|
||||
public static class VisualStylesTable
|
||||
{
|
||||
private static Dictionary<SuperGridStyle, DefaultVisualStyles>
|
||||
_DefaultStyles = new Dictionary<SuperGridStyle,DefaultVisualStyles>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the DefaultVisualStyles for specified SuperGrid style.
|
||||
/// </summary>
|
||||
/// <param name="style">SuperGridStyle to return.</param>
|
||||
/// <returns>An instance of DefaultVisualStyle.</returns>
|
||||
public static DefaultVisualStyles GetStyle(SuperGridStyle style)
|
||||
{
|
||||
DefaultVisualStyles visualStyle;
|
||||
bool cacheStyle = true;
|
||||
|
||||
if (style == SuperGridStyle.Metro || !StyleManager.ColorTint.IsEmpty)
|
||||
cacheStyle = false;
|
||||
|
||||
if (cacheStyle == false || !_DefaultStyles.TryGetValue(style, out visualStyle))
|
||||
{
|
||||
VisualStyleFactory factory = VisualStyleFactory.GetStyleFactory(style);
|
||||
|
||||
visualStyle = factory.CreateStyle();
|
||||
|
||||
if (cacheStyle) // Do not cache Metro style
|
||||
_DefaultStyles.Add(style, visualStyle);
|
||||
}
|
||||
|
||||
return visualStyle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces an system style with the specified visual style.
|
||||
/// </summary>
|
||||
/// <param name="style">SuperGridStyle to replace.</param>
|
||||
/// <param name="visualStyle">DefaultVisualStyles to replace the system style with.</param>
|
||||
public static void SetStyleFactory(SuperGridStyle style, DefaultVisualStyles visualStyle)
|
||||
{
|
||||
_DefaultStyles[style] = visualStyle;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines available pre-defined SuperGrid visual styles.
|
||||
/// </summary>
|
||||
public enum SuperGridStyle
|
||||
{
|
||||
/// <summary>
|
||||
/// Office 2010 Blue style.
|
||||
/// </summary>
|
||||
Office2010Blue,
|
||||
/// <summary>
|
||||
/// Office 2010 Silver style.
|
||||
/// </summary>
|
||||
Office2010Silver,
|
||||
/// <summary>
|
||||
/// Office 2010 Black style.
|
||||
/// </summary>
|
||||
Office2010Black,
|
||||
/// <summary>
|
||||
/// Metro Style.
|
||||
/// </summary>
|
||||
Metro
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user