private void textControl1_Loaded(object sender, RoutedEventArgs e)
{
/*期望在控件加载过后,界面上的默认字体和段落设置是:
<标题 fontSize="小四" Chinesefont="黑体" Eastfont="Times New Roman" SpacingBefore="0.5行" SpacingAfter="0.5行"></标题>
<段落 fontSize="小四" Chinesefont="宋体" Eastfont="Times New Roman" SpacingBefore="0行" SpacingAfter="0行" firstLine="true"
Line="20磅" LineRule="固定值" Justification="左对齐"></段落>*/
TXTextControl.ParagraphFormat p = new TXTextControl.ParagraphFormat();
p.Alignment = TXTextControl.HorizontalAlignment.Center;//设置成功:左对齐
p.TopDistance = 0;//就是distance的Before
p.BottomDistance = 20;//就是distance的After,0.5行对应2.1mm,BottomDistance怎么设置成2.1mm?
p.LeftIndent = 2;//期望首行缩进,实际无效
//行间距的设置固定值,20磅还未实现
textControl1.ParagraphFormat = p;
textControl1.FontSize = 12;//设置不成功,实际显示大小9:期望显示小四(对应的是12),
textControl1.Selection.FontName = "宋体";//设置成功:界面默认显示宋体。最好中文字体和西文字体分开设置好
textControl1.Focus();
} |