Let's say I clicked somewhere inside the RichTextBox control. How can I get the current line the carriage is in?
Btw is for extracting the entire text string of this string.
What does RichTextBox.GetLineFromCharIndex () do . Pass the value of the SelectionStart property.
This worked for me:
this.WordWrap = false; int cursorPosition = this.SelectionStart; int lineIndex = this.GetLineFromCharIndex(cursorPosition); string lineText = this.Lines[lineIndex]; this.WordWrap = true;
One way is to send an EM_LINEFROMCHAR message . I am sure there are other ways.
If you want to get the current line number from the Control editor, where you are currently debugging,
int lineNumber = (new StackTrace()).GetFrame(1).GetFileLineNumber();
I think this is useful for your problem.
Source: https://habr.com/ru/post/1307725/More articles:How to observe NSScroller changes? - cocoaIs there a way to remove a form element without using jQuery.remove ()? - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1307722/reduce-boilerplate-of-adding-functions-to-a-function-queue&usg=ALkJrhjA20LA_WvitSRWXXXwqdBPZ_W2fwFile System Transactions Using .NET on WinXP - c #TSQL: Script global variable? - sql-serverWhy did this properly escalate the SQL query? - sqlDisplay a presentation using modalPresentationStyle - cocoa-touchhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1307728/what-is-the-best-way-to-track-unique-visitors&usg=ALkJrhj6Sudi_BDJY1Ik8YoUPRPzJnftxgHow atomic * should * create an Ajax form? - javascriptHow do you download a view on top of another view on an iPad - iphoneAll Articles