2

Windows 8の新機能を使用しておりRichEditBox、テキスト範囲を選択してテキストの色を変更しようとしています。以下のコードは、選択したテキストに下線を付けて背景を変更しますが、変更されForegroundColorず、テキストは黒のままです。

result.Document.SetText(Windows.UI.Text.TextSetOptions.None, "Hello World");            
var range = result.Document.GetRange(0, 5);

range.CharacterFormat.Underline = Windows.UI.Text.UnderlineType.DoubleWave;
range.CharacterFormat.ForegroundColor = Windows.UI.Color.FromArgb(255, 0, 0, 255);
range.CharacterFormat.BackgroundColor = Windows.UI.Color.FromArgb(255, 0, 255, 0);

ITextRangeの内側のテキストの色を変更するにはどうすればよいですRichEditBoxか?

4

1 に答える 1

3

Document.ApplyDisplayUpdatesテキストの変更を確認するには、電話する必要があります。

result.Document.ApplyDisplayUpdates();
于 2012-09-19T00:35:04.650 に答える