0
invoke 메서드에서 색상 텍스트 RickTextBox wpf를 변경해 봅니다. 하지만 좀 곤란 해. 내 문제는'SolidBrush'매개 변수 유형이 'Foreground'속성의 서식 지정에 유효하지 않습니다. 매개 변수 이름 : 값
'SolidBrush'매개 변수 유형이 'Foreground'속성의 서식 지정에 유효하지 않습니다. 매개 변수 이름 : 값
내 코드
MethodInvoker action = delegate
{
TextRange textRange = new TextRange(RtTextProcess.Document.ContentStart, RtTextProcess.Document.ContentEnd);
if (txtColor == null) txtColor = Color.Black;
int start = textRange.Text.Length;
var txt = string.Concat(DateTime.Now.ToString(), " : ", text);
if (textRange.Text == "\r\n")
{
textRange.Text = "";
}
else
{
textRange.Text += txt.ToString();
}
TextPointer start1 = textRange.Start.GetPositionAtOffset(start, LogicalDirection.Forward);
TextPointer end = textRange.Start.GetPositionAtOffset(txt.Length, LogicalDirection.Backward);
if (start1 != null && end != null)
{
RtTextProcess.Selection.Select(start1, end);
}
// My error is here
textRange.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Red);
string rtb = RtTextProcess.Selection.Text;
};
RtTextProcess.Dispatcher.Invoke(action);
나에게
감사를 도와주세요!