richtextbox

Display NLog trace in RichTextBox

荒凉一梦 提交于 2019-12-06 12:25:42
问题 I whant to display NLog trace into RichTextBox at the same time when app executes logger.Trace("This is a Trace message"); logger.Debug("This is a Debug message"); logger.Info("This is an Info message"); logger.Warn("This is a Warn message"); logger.Error("This is an Error message"); logger.Fatal("This is a Fatal error message"); Has NLog any global event so it is possible to use it and populate RichTextBox ? Thank you! 回答1: We have to install https://www.nuget.org/packages/NLog.Windows.Forms

Richtextbox lines count

微笑、不失礼 提交于 2019-12-06 12:02:44
I'm developing a text editor in C#, and I'm trying to make a line count. private void updateNumberLabel() { Point pos = new Point(0, 0); int firstIndex = Document.GetCharIndexFromPosition(pos); int firstLine = Document.GetLineFromCharIndex(firstIndex); pos.X = ClientRectangle.Width; pos.Y = ClientRectangle.Height; int lastIndex = Document.GetCharIndexFromPosition(pos); int lastLine = Document.GetLineFromCharIndex(lastIndex); int actualLine = Document.GetLineFromCharIndex(actualPos); pos = Document.GetPositionFromCharIndex(lastIndex); if (lastLine != actualLine) { numberLabel.Text = ""; for

What is the most efficient way to count all of the words in a richtextbox?

人盡茶涼 提交于 2019-12-06 12:01:00
问题 I am writing a text editor and need to provide a live word count. Right now I am using this extension method: public static int WordCount(this string s) { s = s.TrimEnd(); if (String.IsNullOrEmpty(s)) return 0; int count = 0; bool lastWasWordChar = false; foreach (char c in s) { if (Char.IsLetterOrDigit(c) || c == '_' || c == '\'' || c == '-') { lastWasWordChar = true; continue; } if (lastWasWordChar) { lastWasWordChar = false; count++; } } if (!lastWasWordChar) count--; return count + 1; } I

Is there an open source javascript rich text editor similar to gmail's? [closed]

感情迁移 提交于 2019-12-06 11:58:28
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I've looked at free javascript html editors, and I haven't found any that I feel handle links intuitively. I like the way the gmail editor does it (also the same way blogger.com) does it. Does anyone know if there is an open source editor that handles linking that way? Jquery would be preferable. I use TinyMCE myself as Banzor suggests but here are a few other alternatives eash with their own strengths:

WPF RichTextBox - get whole word at current caret position

被刻印的时光 ゝ 提交于 2019-12-06 11:36:13
问题 I enabled spelling on my WPF richtextbox and I want to get the misspelled word at current caret position before the context menu with spelling suggestions is displayed. 回答1: The new way void richTextBox1_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Back) { TextPointer start = richTextBox1.CaretPosition; string text1 = start.GetTextInRun(LogicalDirection.Backward); TextPointer end = start.GetNextContextPosition(LogicalDirection.Backward); string text2 = end.GetTextInRun

Temporaily disabling the C# Rich Edit undo buffer while performing syntax highlighting

我与影子孤独终老i 提交于 2019-12-06 09:48:19
问题 I already have a pretty decent syntax highlighter in my Rich Edit control but I have one final problem before it is fully useful: Whenever I run the syntax coloring it records those coloring actions in the undo buffer, which I do not really want. Is there any way to temporarily disable recording undo actions so that after a coloring the user can press undo and it will just undo the user's own actions and not the automated syntax highlighter? I don't think I have the time to implement the

RichTextBox removes escape character from the text

一个人想着一个人 提交于 2019-12-06 09:46:34
问题 before adding the text to RTF property in RichTextBox, i make some processing on the text, add escape character then divide the data to multiline. the text is line1 \n\u001aline2 \n\u001aline3 \n\u001aline4 When i use VS 2015 with .Net 4.6.2 the value in RTF property is {\\rtf1\\fbidis\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Arial;}}\r\n\\viewkind4\\uc1\\pard\\ltrpar\\lang3073\\fs24 Line1 \\par\r\n\\v\\'1a\\v0 Line2 \\par\r\n\\v\\'1a\\v0 Line3 \\par\r\n\\v\\'1a\\v0 Line4\\par\r\n}\r\n

Check if selected text on richtextbox is not all bold or mixed [C#] [duplicate]

╄→гoц情女王★ 提交于 2019-12-06 07:36:33
问题 This question already has an answer here : Check if selected text on richtextbox is all bold or not (1 answer) Closed 3 years ago . How to check if selected text on richtextbox that its chars is not all bold. For example: notbold bold notbold ← this is mixed. Im not all bold ← this is not all bold This is the code I have made, it checks selected text on richtextbox whether the text contains some bolded text or not. its slow because its checking the char one by one using Selection.Start to

Changing an extended RichTextBox text in constructor doesn't work

帅比萌擦擦* 提交于 2019-12-06 07:20:58
I have the following class: public partial class RichTextBoxEx : RichTextBox { public RichTextBoxEx() { InitializeComponent(); Text = "Some Text"; } } However, when I place it over a form and run the program, the RichTextBox is empty. What is the problem and how can I fix it? I assume there is something basic I'm missing here, but I cannot figure out what, and I did not manage to find any information about this. The property values which you set in constructor of the control are usually respected. But for Text property, the case is a bit different. I've already described about it in another

Submitting a form with a Dojo Rich Text Editor

北慕城南 提交于 2019-12-06 05:18:13
Does anyone out there know how to submit a form that contains a Dojo Rich Text Editor? I've tried adding the "name" attribute to my element that is decorated with dojoType="dijit.Editor", however, I don't see any of the HTML on my receiving process. I've checked the documentation and I don't see any clear example (other than connecting the on submit event of the form in question with another function that sets the data of a hidden input with the "value" of the Rich Text Editor"). I would assume there has to be some "easier" way to do this? Here im able to send the value to the server, and able