コード例 #1
0
 public TimedTextStyle()
 {
     BackgroundColor = DefaultBackgroundColor;
     Color = DefaultColor;
     DisplayAlign = DefaultDisplayAlign;
     Extent = DefaultExtent;
     FontFamily = DefaultFontFamily;
     FontSize = new Length
     {
         Unit = LengthUnit.Cell,
         Value = 1
     };
     FontStyle = DefaultFontStyle;
     FontWeight = DefaultFontWeight;
     Id = Guid.NewGuid().ToString();
     LineHeight = null;
     Opacity = DefaultOpacity;
     Origin = DefaultOrigin;
     Overflow = DefaultOverflow;
     Padding = DefaultPadding;
     ShowBackground = DefaultShowBackground;
     TextAlign = DefaultTextAlignment;
     Direction = DefaultDirection;
     Visibility = DefaultVisibility;
     WrapOption = DefaultWrapOption;
     OutlineColor = DefaultOutlineColor;
     OutlineWidth = new Length { Value = 0.0, Unit = LengthUnit.Pixel };
     OutlineBlur = new Length { Value = 0.0, Unit = LengthUnit.Pixel };
 }
コード例 #2
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;
 }