/// <summary> /// Set a custom 3-icon set. /// </summary> /// <param name="Options">3-icon set options.</param> public void SetCustomIconSet(SLThreeIconSetOptions Options) { SLConditionalFormattingRule cfr = new SLConditionalFormattingRule(); cfr.Type = ConditionalFormatValues.IconSet; cfr.IconSet.Reverse = Options.ReverseIconOrder; cfr.IconSet.ShowValue = !Options.ShowIconOnly; switch (Options.IconSetType) { case SLThreeIconSetValues.ThreeArrows: cfr.IconSet.IconSetType = SLIconSetValues.ThreeArrows; break; case SLThreeIconSetValues.ThreeArrowsGray: cfr.IconSet.IconSetType = SLIconSetValues.ThreeArrowsGray; break; case SLThreeIconSetValues.ThreeFlags: cfr.IconSet.IconSetType = SLIconSetValues.ThreeFlags; break; case SLThreeIconSetValues.ThreeSigns: cfr.IconSet.IconSetType = SLIconSetValues.ThreeSigns; break; case SLThreeIconSetValues.ThreeStars: cfr.IconSet.IconSetType = SLIconSetValues.ThreeStars; break; case SLThreeIconSetValues.ThreeSymbols: cfr.IconSet.IconSetType = SLIconSetValues.ThreeSymbols; break; case SLThreeIconSetValues.ThreeSymbols2: cfr.IconSet.IconSetType = SLIconSetValues.ThreeSymbols2; break; case SLThreeIconSetValues.ThreeTrafficLights1: cfr.IconSet.IconSetType = SLIconSetValues.ThreeTrafficLights1; break; case SLThreeIconSetValues.ThreeTrafficLights2: cfr.IconSet.IconSetType = SLIconSetValues.ThreeTrafficLights2; break; case SLThreeIconSetValues.ThreeTriangles: cfr.IconSet.IconSetType = SLIconSetValues.ThreeTriangles; break; } cfr.IconSet.Is2010 = SLIconSet.Is2010IconSet(cfr.IconSet.IconSetType); if (Options.IsCustomIcon) { X14.IconSetTypeValues istv = X14.IconSetTypeValues.ThreeTrafficLights1; uint iIconId = 0; SLIconSet.TranslateCustomIcon(Options.Icon1, out istv, out iIconId); cfr.IconSet.CustomIcons.Add(new SLConditionalFormattingIcon2010() { IconSet = istv, IconId = iIconId }); SLIconSet.TranslateCustomIcon(Options.Icon2, out istv, out iIconId); cfr.IconSet.CustomIcons.Add(new SLConditionalFormattingIcon2010() { IconSet = istv, IconId = iIconId }); SLIconSet.TranslateCustomIcon(Options.Icon3, out istv, out iIconId); cfr.IconSet.CustomIcons.Add(new SLConditionalFormattingIcon2010() { IconSet = istv, IconId = iIconId }); cfr.IconSet.Is2010 = true; } SLConditionalFormatValueObject cfvo; cfvo = new SLConditionalFormatValueObject(); cfvo.Type = ConditionalFormatValueObjectValues.Percent; cfvo.Val = "0"; cfr.IconSet.Cfvos.Add(cfvo); cfvo = new SLConditionalFormatValueObject(); cfvo.Type = this.TranslateRangeValues(Options.Type2); cfvo.Val = Options.Value2; cfvo.GreaterThanOrEqual = Options.GreaterThanOrEqual2; cfr.IconSet.Cfvos.Add(cfvo); cfvo = new SLConditionalFormatValueObject(); cfvo.Type = this.TranslateRangeValues(Options.Type3); cfvo.Val = Options.Value3; cfvo.GreaterThanOrEqual = Options.GreaterThanOrEqual3; cfr.IconSet.Cfvos.Add(cfvo); cfr.HasIconSet = true; this.AppendRule(cfr); }
/// <summary> /// Set a custom 3-icon set. /// </summary> /// <param name="IconSetType">The type of 3-icon set.</param> /// <param name="ReverseIconOrder">True to reverse the order of the icons. False to use the default order.</param> /// <param name="ShowIconOnly">True to show only icons. False to show both icon and value.</param> /// <param name="GreaterThanOrEqual2">True if values are to be greater than or equal to the 2nd range value. False if values are to be strictly greater than.</param> /// <param name="Value2">The 2nd range value.</param> /// <param name="Type2">The conditional format type for the 2nd range value.</param> /// <param name="GreaterThanOrEqual3">True if values are to be greater than or equal to the 3rd range value. False if values are to be strictly greater than.</param> /// <param name="Value3">The 3rd range value.</param> /// <param name="Type3">The conditional format type for the 3rd range value.</param> public void SetCustomIconSet(SLThreeIconSetValues IconSetType, bool ReverseIconOrder, bool ShowIconOnly, bool GreaterThanOrEqual2, string Value2, SLConditionalFormatRangeValues Type2, bool GreaterThanOrEqual3, string Value3, SLConditionalFormatRangeValues Type3) { SLThreeIconSetOptions Options = new SLThreeIconSetOptions(IconSetType); Options.ReverseIconOrder = ReverseIconOrder; Options.ShowIconOnly = ShowIconOnly; Options.GreaterThanOrEqual2 = GreaterThanOrEqual2; Options.Value2 = Value2; Options.Type2 = Type2; Options.GreaterThanOrEqual3 = GreaterThanOrEqual3; Options.Value3 = Value3; Options.Type3 = Type3; this.SetCustomIconSet(Options); }