richtextbox

Printing RichTextBox

被刻印的时光 ゝ 提交于 2019-12-29 07:12:37
问题 I am making a simple WinForms App and I wanted to allow the user to print the Text from RichTextBox. I followed MSDN link then.. And it works for a real printer (by real I mean that one I can touch:) ) But what if I want use some kind of PDF Printer? Then I must say it works when only one page is printed. Every next page is being printed on the same, first page , which means the text is being overprinted. This is obvious, but what I can do do force PDF Printer to create a new Page? This is my

WPF RichTextBox Syntax Highlighting Issue

给你一囗甜甜゛ 提交于 2019-12-28 13:38:06
问题 Hello everyone I've been working on a WPF application that has a text editor this text editor should apply some styling or colorizing over some tokens (keywords) to highlight it and make it obvious,,, the problem is i tried very very hard but i still get the same result which is when the user enters one of the keywords the whole text after that keyword is being styled ! just imagine if you types the " string " keyword in " C# " the whole text after it will be colored blue. this was the code i

Reading PDF in C# [closed]

限于喜欢 提交于 2019-12-28 06:33:10
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I want to read and display the contents of the PDF files into my RichtextBox. I am using windows application C#. Is it possible? What is the way to do it? 回答1: You can use Adobe PDF IFilter Library to convert a

How to color different words with different colors in a RichTextBox while a user is writing and raise an event when that colored text is clicked

假装没事ソ 提交于 2019-12-28 03:14:13
问题 When a user writes some words in a rich text box, if that word matches some specific word, than the color of the that word should automatically change. When the user clicks on that particular colored text, it should raise an event. 回答1: 1) An User inserts some text in a RichTextBox 2) If any word entered is part of a pre-defined list of words, that word should change color (define a color related to each word. 3) When a mouse click event is generated on a colored word, an event is raised.

C#/WPF: Disable Text-Wrap of RichTextBox

五迷三道 提交于 2019-12-28 03:04:37
问题 Does anyone know how I can disable the text wrapping of a RichTextBox ? E.g. if I have a large string which doesn't fit in the window, the RichTextBox places the part of the string which can't be shown of a new line. I want to disable that (and make it visible only by using the Scrollbar ). Thanks a lot. Cheers 回答1: A RichTextBox in WPF is simply an editor for a FlowDocument. According to MSDN: Text always wraps in a RichTextBox . If you do not want text to wrap then set the PageWidth on the

How to use multi color in richtextbox [duplicate]

大憨熊 提交于 2019-12-28 02:04:57
问题 This question already has answers here : Color different parts of a RichTextBox string (8 answers) Closed 3 years ago . I using C# windows forms and I have richtextbox and I want to color some text in red, some in green and some in black. How to do so? Image attached. 回答1: System.Windows.Forms.RichTextBox has got a property of type Color of the name SelectionColor which gets or sets the text color of the current selection or insertion point. You can use this property to mark specific fields

How can I make a hyperlink work in a RichTextBox?

别说谁变了你拦得住时间么 提交于 2019-12-27 17:29:07
问题 When I add www.stackoverflow.com into my RichTextBox and run the program it is shown in blue and as a hyperlink yet when I click it nothing happens. How can I fix this? 回答1: Make sure the text property includes a valid url. E.g. http://www.stackoverflow.com/ set the DetectUrls property to true Write an event handler for the LinkClicked event. Personally, I wouldn't pass "IExplore.exe" in as a parameter to the Process.Start call as Microsoft advise as this presupposes that it is installed, and

How to save content of RichTextBox in BlockUIContainer, to RTF file?

半城伤御伤魂 提交于 2019-12-25 15:15:13
问题 I made two richtexbox, one small richtexbox nested in a big richtextbox by using BlockUIContainer, see XAML file below. <RichTextBox IsDocumentEnabled="True" x:Name="first" HorizontalAlignment="Left" Height="174" Margin="120,136,0,0" VerticalAlignment="Top" Width="254" TextChanged="first_TextChanged" MouseDoubleClick="first_MouseDoubleClick"> <FlowDocument> <Paragraph> <Run Text="RichTextBox"/> </Paragraph> <BlockUIContainer> <RichTextBox IsReadOnly="True" x:Name="second" MouseDoubleClick=

RichTextBox - sorting lines randomly

我与影子孤独终老i 提交于 2019-12-25 06:47:53
问题 I want to write an application which sorts randomly line of text which I copy from a source and paste into RichTextBox area. However, there is one condition - text is formatted (some words are in bold, underline etc.). So any suggestions? How should it look like? I think I should use RichTextBox.Rtf or something but I am really a beginner and I appreciate every hint or example code. Thanks 回答1: It is a bit tricky. You can retrieve the formatted RTF text lines like this string[] rtfLines = new

How can I disable the default RichTextBox command for Ctrl+1?

久未见 提交于 2019-12-25 06:46:57
问题 Snoop shows that the command is "ApplySingleSpace", but when I try disabling it via the method described in this article . Like this: <RichTextBox.CommandBindings> <CommandBinding Command="ApplySingleSpace" CanExecute="BlockTheCommand"/> </RichTextBox.CommandBindings> . private void BlockTheCommand(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = false; e.Handled = true; } My app crashes because there is no ApplySingleSpace command. ApplySingleSpace is not in the EditingCommands