public CreateMaskBrush ( CanvasGeometry geometry, Color color ) : System.Threading.Tasks.Task | ||
geometry | CanvasGeometry | |
color | Color | |
Результат | System.Threading.Tasks.Task |
private async void TextBlock_SizeChanged(object sender, SizeChangedEventArgs e) { var textblock = sender as TextBlock; utextblock = new UniversalElement(sender); var textformat = new CanvasTextFormat() { FontFamily = textblock.FontFamily.Source, FontSize = (float)textblock.FontSize, FontStretch = textblock.FontStretch, FontWeight = textblock.FontWeight }; var textlayout = new CanvasTextLayout(utextblock.Masker.Device, textblock.Text, textformat, (float)textblock.ActualWidth + 6, (float)textblock.ActualHeight + 6); var geometry = CanvasGeometry.CreateText(textlayout); await utextblock.CreateMaskBrush(geometry.Stroke(3), Colors.Blue); var first = (utextblock.Element.Parent as Panel).Children.First(); ElementCompositionPreview.SetElementChildVisual(first, utextblock.Visual); }