没有GenericTextParagraphProperties类型
时间: 2024-03-03 22:53:12 浏览: 17
非常抱歉,我的回答有误。在.NET 6中,没有GenericTextParagraphProperties类。您可以使用TextParagraphProperties类来设置文本段落属性,例如行间距、对齐方式等。以下是一个示例:
```csharp
FormattedText formattedText = new FormattedText(
"Hello, world!",
CultureInfo.CurrentCulture,
FlowDirection.LeftToRight,
new Typeface("Arial"),
12,
Brushes.Black,
new TextFormatter(new TextParagraphProperties(), new TextRunProperties(), new FormattedTextOptions() { TypographyProperties = new TypographyProperties() { CharacterSpacing = 2 } }));
formattedText.SetFontSize(18);
formattedText.SetForegroundBrush(Brushes.Red);
// 绘制 formattedText 对象
```
请注意,您仍然需要使用TextFormatter和FormattedTextOptions类来创建FormattedText对象,并使用TypographyProperties属性来设置字符间距。TextParagraphProperties的默认值通常已经足够,您可以直接使用它的默认构造函数创建它的实例。
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![mp4](https://img-home.csdnimg.cn/images/20210720083504.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)