private TextBlock GetStyledTextblock(TimedTextStyle style, double width, double height, bool fOutline)
        {
            TextBlock textblock = new TextBlock();

            //textblock.Width = width;
            textblock.FontStyle         = style.FontStyle;
            textblock.FontWeight        = style.FontWeight;
            textblock.VerticalAlignment = VerticalAlignment.Bottom;
            textblock.FontFamily        = style.FontFamily;
            if (!double.IsNaN(height) && height != 0)
            {
                textblock.FontSize = Math.Round(style.FontSize.ToPixelLength(height));
            }
            textblock.Foreground = GetCachedBrush(fOutline ? style.OutlineColor : style.Color);
            textblock.Opacity    = style.Visibility == Visibility.Visible
                                    ? style.Opacity
                                    : 0;
            //textblock.TextWrapping = style.WrapOption;
            textblock.TextAlignment = style.TextAlign;
            return(textblock);
        }
 /// <summary>
 /// Will merge this CaptionAnimationElement's Style with the specified Style.
 /// </summary>
 /// <param name="s">The style to merge with</param>
 public void MergeStyle(TimedTextStyle s)
 {
     switch (PropertyName)
     {
         case "backgroundColor":
             s.BackgroundColor = Style.BackgroundColor;
             break;
         case "color":
             s.Color = Style.Color;
             break;
         case "displayAlign":
             s.DisplayAlign = Style.DisplayAlign;
             break;
         case "display":
             s.Display = Style.Display;
             break;
         case "extent":
             s.Extent = Style.Extent;
             break;
         case "fontFamily":
             s.FontFamily = Style.FontFamily;
             break;
         case "fontSize":
             s.FontSize = Style.FontSize;
             break;
         case "fontStyle":
             s.FontStyle = Style.FontStyle;
             break;
         case "fontWeight":
             s.FontWeight = Style.FontWeight;
             break;
         case "lineHeight":
             s.LineHeight = Style.LineHeight;
             break;
         case "opacity":
             s.Opacity = Style.Opacity;
             break;
         case "origin":
             s.Origin = Style.Origin;
             break;
         case "overflow":
             s.Overflow = Style.Overflow;
             break;
         case "padding":
             s.Padding = Style.Padding;
             break;
         case "showBackground":
             s.ShowBackground = Style.ShowBackground;
             break;
         case "textAlign":
             s.TextAlign = Style.TextAlign;
             break;
         case "visibility":
             s.Visibility = Style.Visibility;
             break;
         case "wrapOption":
             s.WrapOption = Style.WrapOption;
             break;
         case "zIndex":
             s.ZIndex = Style.ZIndex;
             break;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Will merge this CaptionAnimationElement's Style with the specified Style.
        /// </summary>
        /// <param name="s">The style to merge with</param>
        public void MergeStyle(TimedTextStyle s)
        {
            switch (PropertyName)
            {
            case "backgroundColor":
                s.BackgroundColor = Style.BackgroundColor;
                break;

            case "color":
                s.Color = Style.Color;
                break;

            case "displayAlign":
                s.DisplayAlign = Style.DisplayAlign;
                break;

            case "display":
                s.Display = Style.Display;
                break;

            case "extent":
                s.Extent = Style.Extent;
                break;

            case "fontFamily":
                s.FontFamily = Style.FontFamily;
                break;

            case "fontSize":
                s.FontSize = Style.FontSize;
                break;

            case "fontStyle":
                s.FontStyle = Style.FontStyle;
                break;

            case "fontWeight":
                s.FontWeight = Style.FontWeight;
                break;

            case "lineHeight":
                s.LineHeight = Style.LineHeight;
                break;

            case "opacity":
                s.Opacity = Style.Opacity;
                break;

            case "origin":
                s.Origin = Style.Origin;
                break;

            case "overflow":
                s.Overflow = Style.Overflow;
                break;

            case "padding":
                s.Padding = Style.Padding;
                break;

            case "showBackground":
                s.ShowBackground = Style.ShowBackground;
                break;

            case "textAlign":
                s.TextAlign = Style.TextAlign;
                break;

            case "visibility":
                s.Visibility = Style.Visibility;
                break;

            case "wrapOption":
                s.WrapOption = Style.WrapOption;
                break;

            case "zIndex":
                s.ZIndex = Style.ZIndex;
                break;
            }
        }