【发布时间】:2011-08-04 20:40:59
【问题描述】:
我有一个从函数中检索到的名为“oldf”的 FormattedText。
FormattedText oldf = GetFormattedText();
我想用 oldf 来创建 newf,除了文本之外完全一样。
我尝试过类似的方法:
FormattedText newf = new FormattedText("myNewText",oldf.CultureInfo,oldf.FlowDirection,oldf.TypeFace,
oldf.EmSize, oldf.Foreground);
但没有成功。
【问题讨论】:
-
@agent-j - 请尝试做我尝试过的事情,你会发现这是不可能的。
-
您似乎试图滥用
FormattedText。例如,一个 FormattedText 不一定只有一个 ForegroundBrush。因此SetForegroundBrush(Brush foregroundBrush, int startIndex, int count);如果要重用该对象,为什么不直接设置Text属性?