コード例 #1
0
        public Size ToPixelSize(Size?containerSize = null)
        {
            containerSize = containerSize ?? Size.Empty;

            return(new Size
            {
                Height = Height.ToPixelLength(containerSize.Value.Height),
                Width = Width.ToPixelLength(containerSize.Value.Width)
            });
        }
コード例 #2
0
        public Thickness ToThickness(Size?containerSize = null)
        {
            containerSize = containerSize ?? Size.Empty;

            return(new Thickness
            {
                Left = Left.ToPixelLength(containerSize.Value.Width),
                Top = Top.ToPixelLength(containerSize.Value.Height),
            });
        }
コード例 #3
0
 private TextBlock GetStyledTextblock(TimedTextStyle style, double width, double height, bool fOutline)
 {
     TextBlock block = new TextBlock {
         FontStyle = style.FontStyle,
         FontWeight = style.FontWeight,
         VerticalAlignment = VerticalAlignment.Bottom,
         FontFamily = style.FontFamily
     };
     if (!double.IsNaN(height) && (height != 0.0))
     {
         if ((this.CaptionsOverrideSettings != null) && (this.CaptionsOverrideSettings.CharacterSize != CaptionsOverrideSizes.pct100))
         {
             Length length = new Length {
                 Unit = style.FontSize.Unit,
                 Value = style.FontSize.Value * (((double) this.CaptionsOverrideSettings.CharacterSize.ToPercentage()) / 100.0)
             };
             block.FontSize = Math.Round(length.ToPixelLength(height));
         }
         else
         {
             block.FontSize = Math.Round(style.FontSize.ToPixelLength(height));
         }
     }
     block.Foreground = GetCachedBrush(fOutline ? style.OutlineColor : style.Color);
     block.TextAlignment = style.TextAlign;
     return block;
 }