Example #1
0
 /// <summary>
 /// Set a gradient stop given a position and a color. Used in conjunction with SetCustomGradient().
 /// </summary>
 /// <param name="Position">Specifies position of the color, ranging from 0.0 to 1.0.</param>
 /// <param name="ColorTheme">The theme color to be used.</param>
 /// <param name="ColorTint">The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param>
 public void AppendGradientStop(double Position, SLThemeColorIndexValues ColorTheme, double ColorTint)
 {
     SLColor clr = new SLColor(this.listThemeColors, this.listIndexedColors);
     clr.SetThemeColor(ColorTheme, ColorTint);
     GradientStop gs = new GradientStop();
     gs.Position = Position;
     gs.Color = clr.ToSpreadsheetColor();
     listGradientStops.Add(gs);
 }
Example #2
0
        /// <summary>
        /// Set a gradient fill given the shading style and 2 colors.
        /// </summary>
        /// <param name="ShadingStyle">The gradient shading style.</param>
        /// <param name="Color1Theme">The first color as one of the theme colors.</param>
        /// <param name="Color1Tint">The tint applied to the first theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param>
        /// <param name="Color2Theme">The second color as one of the theme colors.</param>
        /// <param name="Color2Tint">The tint applied to the second theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param>
        public void SetGradientFill(SLGradientShadingStyleValues ShadingStyle, SLThemeColorIndexValues Color1Theme, double Color1Tint, SLThemeColorIndexValues Color2Theme, double Color2Tint)
        {
            SLColor clr1 = new SLColor(this.listThemeColors, this.listIndexedColors);
            SLColor clr2 = new SLColor(this.listThemeColors, this.listIndexedColors);

            clr1.SetThemeColor(Color1Theme, Color1Tint);
            clr2.SetThemeColor(Color2Theme, Color2Tint);

            SetGradientFill(ShadingStyle, clr1, clr2);
        }
Example #3
0
        /// <summary>
        /// Set a gradient fill given the shading style and 2 colors.
        /// </summary>
        /// <param name="ShadingStyle">The gradient shading style.</param>
        /// <param name="Color1Theme">The first color as one of the theme colors.</param>
        /// <param name="Color1Tint">The tint applied to the first theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param>
        /// <param name="Color2">The second color.</param>
        public void SetGradientFill(SLGradientShadingStyleValues ShadingStyle, SLThemeColorIndexValues Color1Theme, double Color1Tint, System.Drawing.Color Color2)
        {
            SLColor clr1 = new SLColor(this.listThemeColors, this.listIndexedColors);
            SLColor clr2 = new SLColor(this.listThemeColors, this.listIndexedColors);

            clr1.SetThemeColor(Color1Theme, Color1Tint);
            clr2.Rgb = string.Format("{0}{1}{2}", Color2.R.ToString("x2"), Color2.G.ToString("x2"), Color2.B.ToString("x2"));

            SetGradientFill(ShadingStyle, clr1, clr2);
        }
        /// <summary>
        /// Set a custom 3-color scale.
        /// </summary>
        /// <param name="MinType">The conditional format type for the minimum.</param>
        /// <param name="MinValue">The value for the minimum. If <paramref name="MinType"/> is Value, you can just set this to "0".</param>
        /// <param name="MinColor">The theme color for the minimum.</param>
        /// <param name="MinColorTint">The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param>
        /// <param name="MidPointType">The conditional format type for the midpoint.</param>
        /// <param name="MidPointValue">The value for the midpoint.</param>
        /// <param name="MidPointColor">The theme color for the midpoint.</param>
        /// <param name="MidPointColorTint">The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param>
        /// <param name="MaxType">The conditional format type for the maximum.</param>
        /// <param name="MaxValue">The value for the maximum. If <paramref name="MaxType"/> is Value, you can just set this to "0".</param>
        /// <param name="MaxColor">The theme color for the maximum.</param>
        /// <param name="MaxColorTint">The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param>
        public void SetCustom3ColorScale(SLConditionalFormatMinMaxValues MinType, string MinValue, SLThemeColorIndexValues MinColor, double MinColorTint,
            SLConditionalFormatRangeValues MidPointType, string MidPointValue, SLThemeColorIndexValues MidPointColor, double MidPointColorTint,
            SLConditionalFormatMinMaxValues MaxType, string MaxValue, SLThemeColorIndexValues MaxColor, double MaxColorTint)
        {
            List<System.Drawing.Color> listempty = new List<System.Drawing.Color>();
            SLColor minclr = new SLColor(listempty, listempty);
            if (MinColorTint == 0) minclr.SetThemeColor(MinColor);
            else minclr.SetThemeColor(MinColor, MinColorTint);
            SLColor maxclr = new SLColor(listempty, listempty);
            if (MaxColorTint == 0) maxclr.SetThemeColor(MaxColor);
            else maxclr.SetThemeColor(MaxColor, MaxColorTint);

            SLColor midclr = new SLColor(listempty, listempty);
            if (MidPointColorTint == 0) midclr.SetThemeColor(MidPointColor);
            else midclr.SetThemeColor(MidPointColor, MidPointColorTint);
            this.SetCustomColorScale(MinType, MinValue, minclr, true, MidPointType, MidPointValue, midclr, MaxType, MaxValue, maxclr);
        }
        /// <summary>
        /// Set a custom 2-color scale.
        /// </summary>
        /// <param name="MinType">The conditional format type for the minimum.</param>
        /// <param name="MinValue">The value for the minimum. If <paramref name="MinType"/> is Value, you can just set this to "0".</param>
        /// <param name="MinColor">The theme color for the minimum.</param>
        /// <param name="MinColorTint">The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param>
        /// <param name="MaxType">The conditional format type for the maximum.</param>
        /// <param name="MaxValue">The value for the maximum. If <paramref name="MaxType"/> is Value, you can just set this to "0".</param>
        /// <param name="MaxColor">The color for the maximum.</param>
        public void SetCustom2ColorScale(SLConditionalFormatMinMaxValues MinType, string MinValue, SLThemeColorIndexValues MinColor, double MinColorTint,
            SLConditionalFormatMinMaxValues MaxType, string MaxValue, System.Drawing.Color MaxColor)
        {
            List<System.Drawing.Color> listempty = new List<System.Drawing.Color>();
            SLColor minclr = new SLColor(listempty, listempty);
            if (MinColorTint == 0) minclr.SetThemeColor(MinColor);
            else minclr.SetThemeColor(MinColor, MinColorTint);
            SLColor maxclr = new SLColor(listempty, listempty);
            maxclr.Color = MaxColor;

            SLColor midclr = new SLColor(listempty, listempty);
            this.SetCustomColorScale(MinType, MinValue, minclr, false, SLConditionalFormatRangeValues.Percentile, "", midclr, MaxType, MaxValue, maxclr);
        }
 /// <summary>
 /// Set a custom data bar formatting.
 /// </summary>
 /// <param name="ShowBarOnly">True to show only the data bar. False to show both data bar and value.</param>
 /// <param name="MinLength">The minimum length of the data bar as a percentage of the cell width. The default value is 10.</param>
 /// <param name="MaxLength">The maximum length of the data bar as a percentage of the cell width. The default value is 90.</param>
 /// <param name="ShortestBarType">The conditional format type for the shortest bar.</param>
 /// <param name="ShortestBarValue">The value for the shortest bar. If <paramref name="ShortestBarType"/> is Value, you can just set this to "0".</param>
 /// <param name="LongestBarType">The conditional format type for the longest bar.</param>
 /// <param name="LongestBarValue">The value for the longest bar. If <paramref name="LongestBarType"/> is Value, you can just set this to "0".</param>
 /// <param name="BarColor">The theme color to be used for the data bar.</param>
 /// <param name="Tint">The tint applied to the theme color, ranging from -1.0 to 1.0. Negative tints darken the theme color and positive tints lighten the theme color.</param>
 public void SetCustomDataBar(bool ShowBarOnly, uint MinLength, uint MaxLength, SLConditionalFormatMinMaxValues ShortestBarType, string ShortestBarValue, SLConditionalFormatMinMaxValues LongestBarType, string LongestBarValue, SLThemeColorIndexValues BarColor, double Tint)
 {
     List<System.Drawing.Color> listempty = new List<System.Drawing.Color>();
     SLColor clr = new SLColor(listempty, listempty);
     clr.SetThemeColor(BarColor, Tint);
     this.SetCustomDataBar(ShowBarOnly, MinLength, MaxLength, ShortestBarType, ShortestBarValue, LongestBarType, LongestBarValue, clr);
 }