richtextbox

Decrease the line spacing in TinyMCE textarea

本秂侑毒 提交于 2020-01-12 04:53:45
问题 I am using TinyMCE to provide a rich text editing text editor. But the line spacing between the lines is too much. I have added a screenshot that shows the line spacing I get on pressing an enter. What can be done about it 回答1: There is a css class that is applied to the TinyMCE html content. It looks like you have <p> tags causing the spacing. Honestly, it looks pretty good to me. But you can override in the css class: .tinymce-content p { padding: 0; margin: 2px 0; } See the tinymce docs

How to show html contents with a RichTextBox?

删除回忆录丶 提交于 2020-01-10 04:16:49
问题 I want to show html contents in my form. I tried to it with rich text box. rtBox.Text = body; but it fails. How to show html contents in RichTextBox? I am using VS 2008. 回答1: If you've got HTML content, you could use the WebBrowser control - otherwise you will have to convert the HTML to RTF to render in the RichTextBox 回答2: Use a hidden WebBrowser Control and load it with the html content you want. Then SelectAll() from the WebBrowser, Copy(), and Paste() into the richtextbox. WebBrowser wb

Saving RichTextBox FlowDocument to image

[亡魂溺海] 提交于 2020-01-10 03:17:26
问题 i'am making a programm where i want my RichTextBox content (text+images) to be saved as an image (jpg/png). I tried to use this solution but i get only black filled image from SaveUIAsGraphicFile() I also tried to create FormattedText from my rtb control, printing it works fine, but its not possible to insert images in there. Maybe it is possible to print FlowDocument somehow? 回答1: You could use something like the following method to create a bitmap from a FlowDocument: public BitmapSource

Disabling RichTextBox autoscroll

徘徊边缘 提交于 2020-01-10 03:04:45
问题 I am using RichTextBox control for displaying application logs. I am updating control once a second with a few calls of RichTextBox::AppendText method. What is really annoying for me is that cursor keeps scrolling to the last line of text. Its very uncomfortable in situation when user needs to analyze logs that are at the beginning. I have tried following solution to my problem: int pos = tb_logs.SelectionStart; tb_logs.AppendText("log message"); tb_logs.SelectionStart = pos; This does not go

Disabling RichTextBox autoscroll

十年热恋 提交于 2020-01-10 03:04:38
问题 I am using RichTextBox control for displaying application logs. I am updating control once a second with a few calls of RichTextBox::AppendText method. What is really annoying for me is that cursor keeps scrolling to the last line of text. Its very uncomfortable in situation when user needs to analyze logs that are at the beginning. I have tried following solution to my problem: int pos = tb_logs.SelectionStart; tb_logs.AppendText("log message"); tb_logs.SelectionStart = pos; This does not go

Clicking HyperLinks in a RichTextBox without holding down CTRL - WPF

若如初见. 提交于 2020-01-09 03:41:15
问题 I have a WPF RichTextBox with isReadOnly set to True . I would like users to be able to click on HyperLinks contained within the RichTextBox, without them having to hold down Ctrl . The Click event on the HyperLink doesn't seem to fire unless Ctrl is held-down, so I'm unsure of how to proceed. 回答1: I found a solution. Set IsDocumentEnabled to "True" and set IsReadOnly to "True". <RichTextBox IsReadOnly="True" IsDocumentEnabled="True" /> Once I did this, the mouse would turn into a 'hand' when

CustomRichTextBox StrikeThrough TextDecoration

和自甴很熟 提交于 2020-01-07 06:53:19
问题 I want to add a TextDecorations.Strikethrough decoration button to my custom RichTextBox i am using the code bellow for adding and removing the TextDecoration the thing is that i am getting an InvalidCastException: Unable to cast object of type 'MS.Internal.NamedObject' to type 'System.Windows.TextDecorationCollection'. when i am selecting a range greater than the one that is strikedthrough and clicking the "StrikeThrough" button. My Code private void StrikeOutButton_Click(object sender,

WPF bug: TextRange.GetPropertyValue in RichTextBox

亡梦爱人 提交于 2020-01-06 14:48:35
问题 I have to retrieve the Foreground property of the selected text in a WPF RichtTextBox, but I think, there is a bug in the TextRange.GetPropertyValue function. I've written a simple application to test the error: <RichTextBox x:Name="rtfBox"> <RichTextBox.Document> <FlowDocument> <Paragraph> <Run>run run run</Run> <Hyperlink TargetName="http://stackoverflow.com">stackoverflow.com</Hyperlink> </Paragraph> </FlowDocument> </RichTextBox.Document> </RichTextBox> <Button Content="Click!" Height="28

How to split a long text into multiple pieces/pages to fit into a RichTextBox?

给你一囗甜甜゛ 提交于 2020-01-06 14:34:09
问题 While working on a WinForm application, I would like to split a long text (only characters, no images, no special format) into multiple pieces (pages), in order to fit them into a RichTextBox . The problem is that RichTextBox doesn't support multiple pages. I have to write my own algorithm (some kind of DP programming) to split the text. Currently I am using TextRenderer.MeasureText() to check whether a string can fit into the rich textbox, for example: bool canfit(String str) { Size rbx_size

How can i manage changed value text by highlighting the edited text only?

这一生的挚爱 提交于 2020-01-06 10:07:13
问题 My question might seems to be duplicate although it is not the same issue i had experienced before. I have successfully added a richtexbox column to the datagridview as it has being my problem for a while. now you can add richtextbox to the datagridview. Now am trying to highlight the edited text only but am not setting it work as after i edited the text it highlight the whole text. for an example from what i wanna get "Test" = Test ing from the example i above, i only want to highlight the