Пример #1
0
        // <summary>
        /// Function: Convert ScrollEffectType base info
        /// Author  : Jerry Xu
        /// Date    : 2008-12-17
        /// </summary>
        /// <param name="shape">ShapeDynamicTextBase</param>
        /// <returns>ScrollEffectType</returns>
        private static ScrollEffectType ConvertScrollEffectTypeBaseInfo(ShapeDynamicTextBase shape)
        {
            ScrollEffectType effectType = new ScrollEffectType();

            effectType.IsScrolling = shape.RollWay == RollWay.None ? false : true;
            if (shape.RollWay == RollWay.BottomToTop)
            {
                effectType.Direction = ScrollDirectionType.UP;
            }
            if (shape.RollWay == RollWay.TopToBottom)
            {
                effectType.Direction = ScrollDirectionType.DOWN;
            }
            if (shape.RollWay == RollWay.LeftToRight)
            {
                effectType.Direction = ScrollDirectionType.RIGHT;
            }
            if (shape.RollWay == RollWay.RightToLeft)
            {
                effectType.Direction = ScrollDirectionType.LEFT;
            }
            effectType.Speed = float.Parse(shape.RollRate.ToString());
            return(effectType);
        }
Пример #2
0
        // <summary>
        /// Function: Convert FontInfo
        /// Author  : Jerry Xu
        /// Date    : 2008-12-17
        /// </summary>
        /// <param name="shape">ShapeTime</param>
        /// <returns>VariableTimeType</returns>
        private static FontInfoType ConvertFontInfoType(ShapeTextBase shape)
        {
            FontInfoType font = new FontInfoType();

            font.Font = shape.Font.FontFileName;// ? shape.Font.FontFileName + ".TTF" : shape.Font.FontFileName + ".FON";
            Console.WriteLine("MessageConverter Write ===> " + shape.Font.FontFileName);

            //font.Font = shape.Font.Name;
            //font.FontColor = int.Parse(ConverterHelper.ColorToString(shape.ForeColor,NumberType.Decimal));
            //font.FontColor = UInt32.Parse(ConverterHelper.ColorToString(shape.ForeColor, NumberType.Decimal));
            font.FontColor   = ConverterHelper.ColorToString(shape.ConveredForeColor(shape.SignType), shape.SignType);//UInt32.Parse(ConverterHelper.ColorToString(shape.ForeColor, NumberType.Hex), NumberStyles.HexNumber);
            font.FontKerning = shape.KernAmount;
            font.FontLead    = shape.LeadAmount;
            font.FontSize    = shape.Font.Size;

            //font.FontKerning = shape.
            font.Bold   = (shape.Font.Style & FontStyle.Bold) == FontStyle.Bold;
            font.Italic = (shape.Font.Style & FontStyle.Italic) == FontStyle.Italic;

            ShapeDynamicTextBase dFont = shape as ShapeDynamicTextBase;

#if VERSION_1
            if (dFont != null)
            {
                font.HorizontalJustify = dFont.Align;
                font.VerticalJustify   = dFont.Valign;
            }
            else
            {
                font.HorizontalJustify = shape.TextAlignment;
                font.VerticalJustify   = shape.TextVAlignment;
            }
            font.Effect = shape.TextEffect.Effect;
#else
            if (dFont != null)
            {
                font.HorizontalJustify = (TextHorzJustify)((int)dFont.Align);
                font.VerticalJustify   = (TextVertJustify)((int)dFont.Valign);
            }
            else
            {
                font.HorizontalJustify = (TextHorzJustify)((int)shape.TextAlignment);
                font.VerticalJustify   = (TextVertJustify)((int)shape.TextVAlignment);
            }
            font.Effect = ConvertTextEffect(shape.TextEffect.Effect);
#endif
            //font.HorizontalJustify = shape.TextAlignment;
            //switch(shape.TextVAlignment)
            //{
            //    case Valign.BOTTOM:
            //    case Valign.TOP:
            //        font.VerticalJustify = shape.TextVAlignment;
            //        break;
            //    case Valign.MIDDLE:
            //        font.VerticalJustify = Valign.MIDDLE;
            //        break;
            //}
            //font.VerticalJustify = shape.TextVAlignment;


            font.ShadeXOffset    = shape.TextEffect.ShadowLateralShift;
            font.ShadeYOffset    = shape.TextEffect.ShadowVerticalShift;
            font.BubbleSize      = shape.TextEffect.OutlineWidth;
            font.EffectColor     = ConverterHelper.ColorToString(shape.TextEffect.ConveredEffectColor(shape.SignType), shape.SignType);
            font.BackgroundColor = ConverterHelper.ColorToString(shape.ConveredBackColor(shape.SignType), shape.SignType);

            //v1_9
            //font.Underline = shape.TextAlignment.Underline;
            //font.WordWrap = shape.TextEffect.WordWrap;
            return(font);
        }