0
我有一个名为“oldf”的FormattedText,它是从一个函数中获取的。如何克隆FormattedText?
FormattedText oldf = GetFormattedText();
我想使用oldf创建newf,除了文本以外完全相同。
我想类似的东西:
FormattedText newf = new FormattedText("myNewText",oldf.CultureInfo,oldf.FlowDirection,oldf.TypeFace,
oldf.EmSize, oldf.Foreground);
,但没有成功。
什么是未复制? –
@ agent-j - 请尝试做我尝试过的东西,你会发现这是不可能的。 – Erez
它看起来像你试图滥用'FormattedText'。例如,FormattedText不一定只有一个ForegroundBrush。因此,'SetForegroundBrush(Brush foregroundBrush,int startIndex,int count);'如果你想重新使用这个对象,为什么不直接设置'Text'属性呢? –