richtextbox

How Do I scroll to a string in a Rich Text Box

I ahve a RTB with sufficent text that scrolling is needed user enters a string and I highlight all occurrences using a combination of Find and Select which is great but now I want the ability for a user to press Next and the next higlighted instance should be visible say 2at /3rd of the bounding rectangle ( I would even settle for at th...

WPF RichTextBox scrolling

The richtextbox component in my WPF app is populated using a FlowDocument and the RTB's "Document" property. rtb.ScrollToEnd(); doesn't seem to do anything, and i've even tried calling BringIntoView() on the last "row" added to the table that structures my FlowDocument. Any Suggestions? Thanks! ...

Delete text from RichTextBox

Hello, My problem: I have DataReceived event for SerialPort, which listens to serial port and appends everything to RichTextBox. Now I'd like to save RichTextBox's content to txt file. I could do this: string text = RichTextBox.Text; // save file RichTextBox.Clear(); But I fear (and please correct me if I am wrong), that just between...

In System.Windows.Forms.RichTextBox, how to convert from LineNumber to character position?

I would like the converse of RichTextBox.GetLineFromCharIndex() I have a line number and I want to retrieve the char index for that line. The method might be called RichTextBox.GetCharIndexFromLine(). Is it possible, simply? ...

How to get a single paragraph text from a richtextbox when double clicking on it

I'm having some trouble getting control of the WPF richtextbox control. What I want to is as follows : I have a RichTextBox control called richTextBox1 that I filled up with data from a database. I need to get the text on a single line (meaning - a single paragraph) when I click the control. All I found over the net is a code to copy ...

How to insert XAML into RichTextBox?

A XAML text stored in database, how can I show its text in a RichTextBox after reading the XAML by XmlReader? StringReader stringReader = new StringReader(xamlString); XmlReader xmlReader = XmlReader.Create(stringReader); rt.Document = ??? ------UPDATE------------------- here is the xamlString contents: <Section xmlns="http://schema...

Rich Text Box character set

When I copy, for example, the word "Çamlık" from a web page into a rich text box (forms application) at runtime, it is displayed as "?aml?k". Is there a setting in the richtextbox control or form or application to fix this? If not, what is the "socially acceptable" method? (.Net 2008) ...

Select Range of Text in WPF RichTextBox (FlowDocument) Programmatically

I have this WPF RichTextBox and I want to programmatically select a given range of letters/words and highlight it. I've tried this, but it doesn't work, probably because I'm not taking into account some hidden FlowDocument tags or similar. For example, I want to select letters 3-8 but 2-6 gets selected): var start = MyRichTextBox.Docume...

WinForms RichTextBox: how to perform a formatting on TextChanged?

I have a RichTextBox that I want to re-format when the contents of the RichTextBox changes. I have a TextChanged event handler. The re-formatting (changing colors of selected regions) triggers the TextChanged event. It results in a never-ending loop of TextChange event, reformat, TextChange event, reformat, and so on. How can I disti...

WinForms TextBox : how to reformat asynchronously, without firing TextChanged event

This is a followup to WinForms RichTextBox: how to perform a formatting on TextChanged? I have a Winforms app with a RichTextBox, the app auto-highlights the content of said box. Because the formatting can take a long time for a large document, 10 seconds or more, I've set up a BackgroundWorker to do the re-formatting of a RichTextBox. ...

How can I retrieve hyperlink url from selection text in WPF Richtextbox

How can I retrieve hyperlink url from selection text in WPF Richtextbox? I select a hyperlink string in wpf richtextbox. How can I retrieve the url hyperlink of the selected text? I use the snipset code below. But It cannot effect. TextPointer caretPosition = mainRTB.Selection.Start; Hyperlink hlEdit = GetHyperlinkAncestor(caretPosit...

Capture DragDrop Event of RichTextBox C#

I have a custom RichTextBox Control derived from RichTextBox Control that Windows provides. I am unable to capture the dragDrop Event though the DragEnter event is getting captured, but I dont know why the dragDrop event is not. I have following properties set as true EnableAutoDragDrop=true; AllowDrop=true; What am I missing ?? ...

RichTextBox Control in a Multi-Threaded Application

I'm using a RichTextBox control in a Windows Service to convert RTF to plain text. This method is actually mentioned by MS here: http://msdn.microsoft.com/en-us/library/cc488002.aspx My Windows Service spawns multiple threads (typically 2 x the number of CPU cores), and each of these threads ends up instantiating a separate instance of ...

How to refactor this method C# Window

I have a TextBox to search all occurences of the entered text in RichTextBox Control. The result will be populated in a listbox for traversal pupose after the search gets over. I have written following function to achieve thedesired result.. but its taking good amount of time to complete.. I need some suggestion to fix this issue In sh...

RichTextBox links don't do anything

I have a RichTextBox control on a form with some text, some of which are URLs. The DetectUrls property is set to true. The control properly detects my URLs (they're blue, underlined and the cursor changes to a hand when I hover them). However, when I click on them nothing happens (double-click and ctrl+click are similarly ineffective)...

C# RichTextBox control, making non-URLs hyperlinks?

In a richtextbox I see there's DetectURLs and an event to go along with that... Is there a way to set up a word or series of words to act as a hyperlink even though they are not a hyperlink? My specific use is that I'm writing a ticker program that will scroll information across the bottom of the screen, I would like for some informatio...

Regex to remove onclick="" attributes from HTML elements in ASP.NET C# (Server-side)

I'm trying to write a regex function to remove onclick (also onload, onmouseover etc.) attributes from HTML elements. I want to do this on the server side before the HTML is sent to the client. I have content coming from a Rich Text editor and being displayed on screen in a div, and I want to protect against XSS (Cross Site Scripting). ...

[C#] Celsius symbol in RichTextBox

I write windows application using C# and .NET2.0. In RichTextBox I would like to show Celsius symbol. How to do it? Is it possible? ...

Efficient, flicker-free syntax highligher for vb.net which works as well as the one in the IDE

While I do know the above goal is rather challenging to achieve, I know it can be done. What the one I made does: It compares each word to a word from the list, if its a match, it will physically select the text and change the color, and finally it will return the carat to the position it was in when it highlighted. Issues with this:...

WPF Richtextbox FontFace/FontSize

Hello, I am currently trying to create some basic word processor features in a WPF project. I am using a RichTextBox and am aware of all of the EditingCommands (ToggleBold, ToggleItalic...ect.). The thing I am stuck on is allowing the user to change the fontsize and font face like in MS Office where the value changes for only the selecte...