Пример #1
0
        private TExcelColor(TColorType aColorType, TAutomaticColor aAutomatic, long aRGB, TThemeColor aTheme, int aIndex, double aTint, bool AllowBiff8Indexed)
        {
            FColorType = aColorType;
            FTint      = aTint < -1 ? -1 : aTint > 1 ? 1 : aTint;

            //if (aColorType == TColorType.Automatic && (!Enum.IsDefined(typeof(TAutomaticColor), aAutomatic) || aAutomatic == TAutomaticColor.None))
            //    FlxMessages.ThrowException(FlxErr.ErrInvalidColorEnum, "Automatic");
            FAutomaticType = aAutomatic;

            FRGB = aRGB & 0xFFFFFFFF;

            if (aColorType == TColorType.Theme && (!Enum.IsDefined(typeof(TThemeColor), aTheme) || aTheme == TThemeColor.None))
            {
                FlxMessages.ThrowException(FlxErr.ErrInvalidColorEnum, "Theme");
            }
            FTheme = aTheme;

            if (!AllowBiff8Indexed && aColorType == TColorType.Indexed && (aIndex < 1 || aIndex > 56))
            {
                FColorType     = TColorType.Automatic;
                FAutomaticType = TAutomaticColor.None; //we won't raise an exception here, to avoid issues with old code.
                FIndex         = -9;
                return;
            }
            FIndex = aIndex;
        }
Пример #2
0
 private void CheckColorType(string PropName, TColorType aColorType)
 {
     if (aColorType != ColorType)
     {
         FlxMessages.ThrowException(FlxErr.ErrInvalidColorType, "TExcelColor." + PropName, TCompactFramework.EnumGetName(typeof(TColorType), ColorType), TCompactFramework.EnumGetName(typeof(TColorType), aColorType));
     }
 }
Пример #3
0
 private TExcelColor(TColorType aColorType, TAutomaticColor aAutomatic, long aRGB, TThemeColor aTheme, int aIndex, double aTint)
     : this(aColorType, aAutomatic, aRGB, aTheme, aIndex, aTint, false)
 {
 }