开发者

How to center a bold element?

开发者 https://www.devze.com 2023-01-24 04:49 出处:网络
Hy my example code: Bold b = new开发者_如何学编程 Bold(new Run(\"TODO\")); b.FontSize = 50; My Question is:

Hy my example code:

Bold b = new开发者_如何学编程 Bold(new Run("TODO"));
b.FontSize = 50;

My Question is:

How to center the bold element?


I assume this is in reference to classes in System.Windows.Documents. You need to set the TextAlignment property on the thing (a Paragraph usually) that b is contained in.


The paragraph around the Run should define the alignment.

Bold b = new Bold(new Run("TODO"));
b.FontSize = 50;
var p = new Paragraph(b) {TextAlignment = TextAlignment.Center};
0

精彩评论

暂无评论...
验证码 换一张
取 消