richtextbox

RichTextBox CaretPosition physical location

戏子无情 提交于 2019-12-12 04:49:43
问题 I'm using a RichTextBox class to make some automatic text formatting. And mz question is, how do I get the RichTextBox to put some string immediately after the caret. When I use RichTextBox.CaretPosition.InsertTextInRun("some string") the text is inserted after the current logical block, but I need to be insterted immediately after the caret, in the middle of a Run block. I hope it's clear, thx very much. 回答1: Well, to insert text after the caret i would do this: richTextBox1.Select

How do you search for a string in a rich text box and highlight all found or highlight each line?

拥有回忆 提交于 2019-12-12 04:36:58
问题 I found the following code http://www.dotnetcurry.com/showarticle.aspx?ID=146 and implemented it into my app, however it only finds the string once and to continue looking for other instances of the string you have to keep pressing the search button (bit tedious with 100's of matches). I'd like to find all instances of the search string and if possible highlight each line, failing that highlight the string item like this code already does but all instances not just one. On the link above

Highlight the entire line in a RichTextBox [duplicate]

跟風遠走 提交于 2019-12-12 04:11:47
问题 This question already has an answer here : C# RichTextBox Highlight Line (1 answer) Closed 3 years ago . I want to highlight the entire line, from start to end doesn't matter whether characters are present or not and line may be blank but it should highlight the complete line. Like 回答1: This will highlight a full line in a RichTextBox if WordWrap is off: void highLightALine(RichTextBox rtb, int line, Color hiLight) { int i1 = rtb.GetFirstCharIndexFromLine(line); int i2 = rtb

RichTextBox.RTF return unicode format or ANSI format?

冷暖自知 提交于 2019-12-12 03:43:39
问题 Recently, i'm very confused about the RTF format. I check the RTF 1.6 spec from MSDN, which is native supported in .Net. RTF 1.6 will support Unicode by \uN, and for ANSI, RTF will support multiple byte language via codepage. If we use RichTextBox.RTF to retrieve the RTF format, which format will be returned? Unicode? or ANSI multiple byte? System language configuration depended? or anything else? 回答1: String is always Unicode in .NET. 回答2: solved.. That's because we disable RichTextBox

Custom Caret not being set on initialization in c#

旧时模样 提交于 2019-12-12 03:34:58
问题 I have (painfully) written a stable console control, but am having a tiny issue regarding when starting the object the Caret is not being set to my custom one until I click inside the control on the form or push a key on the keyboard. I can see that I have focus successfully as the default (very faint line) Caret shows up blinking with no problems, even in spite of me constantly trying to destroy the little bugger. (sorry for condensing some of the code. SO limits to 30,000 characters) Here

How can I replace text in RichTextBox form another form?

情到浓时终转凉″ 提交于 2019-12-12 02:27:18
问题 So I have a RichTextBox called richTextBox1 , in a form named XMLEditor I want to be able to rename any chosen word in all parts of the rich text box with anything I want. (Like find and replace in notepad). But I want to use another form called Find (It looks like Find & Replace in notepad) to have functions that will replace the words in the richTextBox1 that is in XMLEditor . The form named Find has a 2 textboxes and 1 button. The first textbox named textBox1 will be used to choose the

Plot chart using values from richTextBox C#

孤街醉人 提交于 2019-12-12 01:51:49
问题 is it possible to plot graphs of data that are collected from a richTextBox? For example I have following text in richTextBox: $GPRMC,152908.00,A,5307.0794359,N,02308.8918827,E,0.049,188.6,280612,0.0,E,D*3A $GPRMC,152909.00,A,5307.0794307,N,02308.8918792,E,0.081,193.3,280612,0.0,E,D*3A $GPRMC,152910.00,A,5307.0794343,N,02308.8918811,E,0.034,42.9,280612,0.0,E,D*0F $GPRMC,152911.00,A,5307.0794410,N,02308.8918827,E,0.099,1.3,280612,0.0,E,D*30 $GPRMC,152912.00,A,5307.0794461,N,02308.8918808,E,0

How to wrap text in RichTextBox?

我的梦境 提交于 2019-12-12 01:23:24
问题 The richtext box is of fixed width. And I don't want to show a horizontal scroll. I want to fix the content in the richtextbox with proper wrapping of words. I have a richtext box with 3 lines. The textwrapping is set to "Wrap" But the text is wrapped like below: Amazing grace how sweet the sou nd That saved a wretch lik e me I once was lost but now found But how I wanted to wrap it is: Amazing grace how sweet the sound That saved a wretch like me I once was lost but now found How do I

Scroll to Position in RichTextBox

时光怂恿深爱的人放手 提交于 2019-12-12 01:06:35
问题 I need help in scrolling to highlighted text/string positions in a rich text box. I was able to find text and highlight it but I want the user to be able to click on a Next button and that event to scroll to the vertical offset position of the first occurrence of the highlighted word to the next and so on after each click. Any help specifically with finding the position for the vertical offset of the line of the highlighted text would be helpful as well. Thanks in advance. 回答1: I found an

RichTextBox add some text in the middle of the text

对着背影说爱祢 提交于 2019-12-12 01:01:27
问题 I have a RichTextBox and I want to add some text in the middle of the text . For example I got this text: "FirstText SecondText" I want to add some text between the "FirstText" and the "SecondText". I have tried to split the text to 2 strings and add to the first my extra text then add him the second string. It worked but it is destroy my richTextBox1.SelectionColor (I got color...). So how can I add text without cutting my richTextBox1.Text or How can I save all the color data? 回答1: You have