richtextbox

Textbox with “new line”

北城以北 提交于 2019-12-01 04:04:47
We tried several ways to make a textbox to accept the "enter", newline, etc.. But we are still facing the same problems. Most of the "Third party" controls allow the user to format the text as he wants. Eg, add color, font, table, etc.. However, for most stylish websites, we do not want to allow the user to format the text that way. But we still want them to make "enter", so we disable most functions (Colors, bold, table, insert image, etc.). But we still have another problem, copy and paste. It is not uncommon to see people that copy from MS Word in the textbox and wham, all the style of the

Wrapping Text in a rich textbox, but not word wrapping it

蓝咒 提交于 2019-12-01 03:57:12
问题 I have a Windows Form with a Rich Textbox control on the form. What I want to do is make it so that each line only accepts 32 characters of text. After 32 characters, I want the text to flow to the next line (I do NOT want to insert any carriage returns). The WordWrap property almost does this, except that it moves all the text entered, up to the last space in the text and moves it all. I just want to neatly wrap the text right after 32 characters. How can I do this? I'm using C#. 回答1: Ok, I

Winforms RichTextBox: How can I determine how many lines of text are visible?

你说的曾经没有我的故事 提交于 2019-12-01 03:16:11
I have a Winforms app containing a RichTextBox. How can I determine how many lines of text are displayed, currently visible? Reason: I want to scroll the caret to the middle of the RichTextBox. I can use RichTextBox.ScrollToCaret() , but that puts the caret at the top of the RichTextBox. I figure, If I know how many lines are displayed, I could move the caret "back" n/2 lines, then call ScrollToCaret(), then restore the original caret position. EDIT: I found EM_GETLINECOUNT , which I thought was the answer, except the doc says: The EM_GETLINECOUNT message retrieves the total number of text

RichTextBox BeginUpdate() EndUpdate() Extension Methods Not Working

感情迁移 提交于 2019-12-01 02:44:14
问题 I have a richTextBox I am using to perform some syntax highlighting. This is a small editing facility so I have not written a custom syntax highlighter - instead I am using Regex s and updating upon the detection of an input delay using an event handler for the Application.Idle event: Application.Idle += new EventHandler(Application_Idle); in the event handler I check for the time the text box has been inactive: private void Application_Idle(object sender, EventArgs e) { // Get time since

How can I make a RichTextBox scroll to the end when I add a new line?

自作多情 提交于 2019-12-01 02:36:57
I have several read only RichTextBox's that are used for logging output. Since they're read only they don't seem to automatically scroll when the text is updated. I can use the TextChanged event to force a scroll to end, but is there not simply a way to set a property or something in the XAML so that scrolling happens like normal? I had googled for your problem and found this post. In the section "Programming the RichTextBox" author had described about getting the behavior what you had been expecting. Please check and let me know if it is of any use. I tried to reproduce your problem and came

Converting tabs into spaces in a RichTextBox

为君一笑 提交于 2019-12-01 01:53:29
I have a WinForms application with a RichTextBox control on the form. Right now, I have the AcceptsTabs property set to true so that when Tab is hit, it inserts a tab character. What I would like to do though is make it so that when Tab is hit, 4 spaces are inserted instead of a \t tab character (I'm using a monospaced font). How can I do this? Add a new class to override your RichTextBox : class MyRichTextBox : RichTextBox { protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if(keyData == Keys.Tab) { SelectionLength = 0; SelectedText = new string(' ', 4); return true; }

Textbox with “new line”

自闭症网瘾萝莉.ら 提交于 2019-12-01 01:47:20
问题 We tried several ways to make a textbox to accept the "enter", newline, etc.. But we are still facing the same problems. Most of the "Third party" controls allow the user to format the text as he wants. Eg, add color, font, table, etc.. However, for most stylish websites, we do not want to allow the user to format the text that way. But we still want them to make "enter", so we disable most functions (Colors, bold, table, insert image, etc.). But we still have another problem, copy and paste.

Adding strings to a RichTextBox in C#

不打扰是莪最后的温柔 提交于 2019-12-01 01:10:49
I currently have a function that will set a value to a RichTextBox, although how could you "add" a value or a new line to it, rather than overwriting existing data in the RichTextBox? richTextBox2.Text = DateTime.Today + " Hello"; agent-j richTextBox2.AppendText(Environment.NewLine + DateTime.Today + " Hello"); richTextBox2.AppendText(String.Format("{0} the date is {1}{2}", "Hello", DateTime.Today, Environment.NewLine)); Please don't use + richTextBox2.Document.Blocks.Clear(); richTextBox2.Document.Blocks.Add(new Paragraph(new Run("string"))); richTextBox2.Text = "Something " + richTextBox2

RichTextBox control, making non-URLs hyperlinks?

偶尔善良 提交于 2019-12-01 00:59:11
问题 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 information to be clickable without putting the long, messy URL of the target. Anyway I can do this? 回答1: Links with arbitrary text in a RichTextBox http://www

How to Set inline Images Vertically Center in RichTextBox

非 Y 不嫁゛ 提交于 2019-12-01 00:18:00
I am working on WPF, i am display RichText data in RichTextBox for that have taken WindowsFormHost, inside that i am taking WinForm RichTextBox to display RichTextData which have Images + Text. But while display that RichTextData images are align to Top and text are align to Bottom, See in Image below, red circle is RichTextImage i want to display images and Text in center. Like Below Image, the Red Circle is RichTextImage that is coming in center with text. My XAML Code is: <Window x:Class="WPFRichTextBox.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x=