richtextbox

Mouse cursor flickers over selected text - how to prevent this?

↘锁芯ラ 提交于 2019-12-21 17:32:59
问题 I'm encountering strange behaviour while moving the mouse over selected text in a RichTextBox (C#, .NET 4.0, WinForms): as I move the mouse cursor, it flickers between Cursors.Arrow and Cursors.IBeam. I found code that disables the flickering: protected override void WndProc(ref System.Windows.Forms.Message m) { if (m.Msg == WM_SETCURSOR) //WM_SETCURSOR is set to 0x20 return; } but then the mouse cursor is stuck as Cursors.Arrow, even when I manually set it to something else, ex: void RTFBox

XAML to Html and vice versa

旧时模样 提交于 2019-12-21 05:47:30
问题 I'm currently working on a SilverLight text editor for my site control panel, I almost done with that, but now I need to convert XAML to Html and vice versa (as you probably know Silverlight's RichTextBox returns XAML ) So I've to convert it to Html. Any idea how can I handle this ? 回答1: Well, it's just XML. So convert Section and Paragraph elements to their appropriate HTML equivalents ( p and div , probably) and do so for the inlines as well ( Run expands to just the text, probably, Span

WPF richTextBox question

老子叫甜甜 提交于 2019-12-21 04:56:11
问题 If a line of text is wrapped to an additional line, how do I determine programmatically the point in the string where it was broken. Example: Input string = "This is a test of a wrapped line of text". Based on the width of the richTextBox it could display: This is a test of a wrapped line of text. What I need to determine is offset in the line of the word(s) that got wrapped. In the above case the word "text". When I extract the Xaml from the richTextBox, I get the original text unwrapped.

Space After New Lines in RichTextBox

谁说我不能喝 提交于 2019-12-21 04:34:05
问题 A RichTextBox puts extra space between lines when a user presses enter or inserts text, and that's what I'm trying to get away from. I searched around and the only decent solution I found is this one: Setter SetParagraphMargin = new Setter(); SetParagraphMargin.Property = Paragraph.MarginProperty; SetParagraphMargin.Value = new Thickness(0); Style style = new Style(); style.TargetType = typeof(Paragraph); style.Setters.Add(SetParagraphMargin); rtb.Resources.Add("Style", style); But this still

C# WPF convert BitmapImage pasted in richtextbox to binary

谁都会走 提交于 2019-12-21 04:26:33
问题 I've got a richtextbox, that I plan on saving to a database, which can be loaded back into the same richtextbox. I've got it working so that I can save the flowdocument as DataFormats.XamlPackage, which saves the images, but the issue is that the text isn't searchable. With DataFormats.Xaml, I've got the text of course, but no images. The images will be pasted in by the end user, not images included with the application. I tried using XamlWriter to get the text into XML, and then grab the

Is it possible to “zoom” the text in a WPF RichTextBox?

心不动则不痛 提交于 2019-12-20 15:27:26
问题 I noticed the WinForms RichTextBox has a ZoomFactor property that I assume is exactly what I want--unfortunately this seems to be entirely missing on the WPF variant. Is there any way I can achieve the same functionality (increasing/decreasing the visible text size of the whole document without actually changing the underlying RTF)? Update: While setting a LayoutTransform on the RichTextBox does seem to work under very simple settings, it's not exactly the same as setting ZoomFactor because

Is it possible to “zoom” the text in a WPF RichTextBox?

♀尐吖头ヾ 提交于 2019-12-20 15:27:20
问题 I noticed the WinForms RichTextBox has a ZoomFactor property that I assume is exactly what I want--unfortunately this seems to be entirely missing on the WPF variant. Is there any way I can achieve the same functionality (increasing/decreasing the visible text size of the whole document without actually changing the underlying RTF)? Update: While setting a LayoutTransform on the RichTextBox does seem to work under very simple settings, it's not exactly the same as setting ZoomFactor because

Save text from rich text box with C#

送分小仙女□ 提交于 2019-12-20 07:40:02
问题 This question has been answered. I've improved the code a bit (at least I think so). It now reminds of the aceepted answer to the question Open file in rich text box with C#. If I haven't made any mistakes (which I may have), the code should save a file with text from the rich text box rtfMain. The default file extension is .txt. You can also use the file extension .rtf. private void menuFileSave_Click(object sender, EventArgs e) { // Create a new SaveFileDialog object using (SaveFileDialog

richTextBox limit of characters?

给你一囗甜甜゛ 提交于 2019-12-20 07:37:04
问题 I'm having a problem with storing amazing amounts of text in a rich TextBox. I'm trying to read a text file fairly big( anywhere from 90mb to 450mb), and put what I've read in a rich textbox. It works in a simple program, but when I do in a complicated program I get an OutOfMemory exception. One thing to note is that when I exit my simple program, I get an OutOfMemory exception right before the program returns 0. Here is my simple program's code: array<String^>^ strArray; StreamReader^ sr;

How can i update cursor position? [duplicate]

你。 提交于 2019-12-20 04:12:38
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Set cursor in RichTextBox private void richTextBox1_TextChanged(object sender, EventArgs e) { string text = richTextBox1.Text.ToString(); text = text.Replace("a", "අ"); text = text.Replace("අඅ", "ආ"); richTextBox1.Text = text.ToString(); } this is my code. in here after getting result cursor position is come in-front of the letter so how i update cursor position after the letter? please help........ 回答1: