I want to replace RichTextBox text with this #303

Closed
opened 2021-08-31 05:42:57 -05:00 by dzx815 · 8 comments
dzx815 commented 2021-08-31 05:42:57 -05:00 (Migrated from github.com)

I want to add colored text by avalonEdit.TextEditor.AppendTxt("test",Brushes.Red )

It is used to display some prompts, because the performance of this is much higher than that of RichTextBox.

But I haven't found such an interface yet. Can you help me?

I want to add colored text by _avalonEdit.TextEditor.AppendTxt("test",Brushes.Red )_ It is used to display some prompts, because the performance of this is much higher than that of RichTextBox. But I haven't found such an interface yet. Can you help me?
goswinr commented 2021-09-02 01:33:15 -05:00 (Migrated from github.com)

I also wanted such an interface. So i implemented it my self:
https://github.com/goswinr/AvalonLog Maybe you can use that one.

on the AvalonLog instance call
public void AppendWithBrush(SolidColorBrush br, string s)

I also wanted such an interface. So i implemented it my self: https://github.com/goswinr/AvalonLog Maybe you can use that one. on the `AvalonLog` instance call `public void AppendWithBrush(SolidColorBrush br, string s)`
dzx815 commented 2021-09-02 04:51:26 -05:00 (Migrated from github.com)

Thank you for your reply.
This is indeed possible, but I still want to see if there is any C#.

This is indeed ok, but I still want to see if there is C#, F# outputs a series of files

image

Thank you for your reply. This is indeed possible, but I still want to see if there is any C#. This is indeed ok, but I still want to see if there is C#, F# outputs a series of files ![image](https://user-images.githubusercontent.com/15151459/131822957-412968b5-a070-4ac6-91ac-5349696a0bfa.png)
goswinr commented 2021-09-02 09:43:36 -05:00 (Migrated from github.com)

Do you get these files when using the nuget package ?
Put <SatelliteResourceLanguages>en</SatelliteResourceLanguages> in the poject file file to not have these translation folders.

Do you get these files when using the nuget package ? Put `<SatelliteResourceLanguages>en</SatelliteResourceLanguages>` in the poject file file to not have these translation folders.
dzx815 commented 2021-09-02 10:25:56 -05:00 (Migrated from github.com)

I am not just because of these additional files, because I also want to make some changes, such as controlling whether to scroll to the bottom, etc.

If there are no other controls, I might try to rewrite your process with c#。

I am not just because of these additional files, because I also want to make some changes, such as controlling whether to scroll to the bottom, etc. If there are no other controls, I might try to rewrite your process with c#。
goswinr commented 2021-09-02 11:07:51 -05:00 (Migrated from github.com)

If you just want to control scrolling open an issue (or PR) at https://github.com/goswinr/AvalonLog and we discuss it there..

If you just want to control scrolling open an issue (or PR) at https://github.com/goswinr/AvalonLog and we discuss it there..
dzx815 commented 2021-09-03 23:35:33 -05:00 (Migrated from github.com)

I have roughly rewritten what I need to use, but I found a bug at present. If you insert a string in the middle of a string of multiple colors, it will cause the subsequent color display to be completely confused.

myCode=
private void Button_Click(object sender, RoutedEventArgs e)
{
new Thread(() => {
this.Dispatcher.Invoke(new Action(() => {
avlog.AppendWithBrush(Brushes.Red, "1");
avlog.AppendWithBrush(Brushes.Black, "2");
//avlog.AppendWithBrush(Brushes.Red, "3");
}), null);
}).Start();
}

image

image

I have roughly rewritten what I need to use, but I found a bug at present. If you insert a string in the middle of a string of multiple colors, it will cause the subsequent color display to be completely confused. myCode= private void Button_Click(object sender, RoutedEventArgs e) { new Thread(() => { this.Dispatcher.Invoke(new Action(() => { avlog.AppendWithBrush(Brushes.Red, "1"); avlog.AppendWithBrush(Brushes.Black, "2"); //avlog.AppendWithBrush(Brushes.Red, "3"); }), null); }).Start(); } ![image](https://user-images.githubusercontent.com/15151459/132082496-d0469a47-e2ca-44aa-9631-b73a72e603ed.png) ![image](https://user-images.githubusercontent.com/15151459/132082520-5f61d678-1f45-485c-aa38-913ac2fef322.png)
goswinr commented 2021-09-10 11:57:56 -05:00 (Migrated from github.com)

@dzx815 It is not a bug its a feature. see my answer here: https://github.com/goswinr/AvalonLog/issues/1

@dzx815 It is not a bug its a feature. see my answer here: https://github.com/goswinr/AvalonLog/issues/1
siegfriedpammer commented 2021-12-20 05:43:49 -06:00 (Migrated from github.com)

I am fairly certain that AvalonEdit is not the right tool for the job. A RichTextBox has features that cannot be mimicked using AvalonEdit. Firstly, AvalonEdit supports only one single font for the whole document and secondly, the highlighting is rule-based and not as with rich text editors like Word based on user input. Implementing these features on top of AvalonEdit is a lot of work, bordering "impossible to get right".

I am fairly certain that AvalonEdit is not the right tool for the job. A `RichTextBox` has features that cannot be mimicked using AvalonEdit. Firstly, AvalonEdit supports only one single font for the whole document and secondly, the highlighting is rule-based and not as with rich text editors like Word based on user input. Implementing these features on top of AvalonEdit is a lot of work, bordering "impossible to get right".
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-icsharpcode/AvalonEdit#303
No description provided.