richtextbox

Creating a newline in rich text box

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 05:02:24
I need help on creating a new line for my RichTextBox which I cant make work when using CheckBox. It keeps overlapping instead of creating a newline of words. Tried using the method of rtbdisplay.text = (display+envrionment.newline); example from my code: if (rbtnSmall.Checked == true) { rtbDisplay.Text = "displaytext".PadRight(20) + "size".PadRight(23) + qty.ToString().PadRight(20) + StrongDummy; } Use the RichTextBox.Text property or the RichtTextBox.AppendText method to append a string with a newline. myRichTextBox.Text += Environment.NewLine + "My new line."; // Or myRichTextBox.AppendText

Components Inside Textbox/RichTextbox in DotNet

前提是你 提交于 2019-12-02 04:46:34
问题 This question was migrated from Software Engineering Stack Exchange because it can be answered on Stack Overflow. Migrated 6 years ago . I am working with a textbox/richtextbox component in WPF and I need to import additional textboxes into it. Currently, I use a RichTextbox control that inserts additional custom textboxes into (they are necessary since it is an expression that cannot otherwise be done). The problem I'm having is I need to focus into the the textbox when the cursor is

How can i update cursor position? [duplicate]

人盡茶涼 提交于 2019-12-02 04:14:52
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........ richTextBox1.Focus(); richTextBox1.SelectionStart = richTextBox1.Text.Length; richTextBox1.ScrollToCaret(); TextBox.SelectionStart Property: Gets or sets the starting position

A WPF RichTextBox + Button in a StackPanel => what a mess?

佐手、 提交于 2019-12-02 03:27:35
问题 This code: <StackPanel Orientation="Horizontal"> <RichTextBox /> <Button Content="Dialog" /> </StackPanel> shows the button somewhere on the left side of the StackPanel ONTO the RichTextBox, WHY? edit: Oh I just saw its a width problem. The RTB has nearly no width and the button is righthand of it. edit: seems I run into this bug: WPF RichTextBox with no width set solution does not work for me! 回答1: You'd be better off using a Grid and the HorizontalAlignment (and VerticalAlignment)

Override ShortCut Keys on .NET RichTextBox

我只是一个虾纸丫 提交于 2019-12-02 03:21:36
I'm using a RichTextBox (.NET WinForms 3.5) and would like to override some of the standard ShortCut keys.... For example, I don't want Ctrl+I to make the text italic via the RichText method, but to instead run my own method for processing the text. Any ideas? Ctrl + I isn't one of the default shortcuts affected by the ShortcutsEnabled property. The following code intercepts the Ctrl + I in the KeyDown event so you can do anything you want inside the if block, just make sure to suppress the key press like I've shown. private void YourRichTextBox_KeyDown(object sender, KeyEventArgs e) { if (

RichTextBox C# Set caret location winforms

这一生的挚爱 提交于 2019-12-02 02:49:46
问题 I am building a chat application where the user enters its text to a richtextbox. In the rich text box there is an initial text which says: "Me: ". Now, when the user press the Home button I want the caret to be located after the "Me: " string. So for Shift+Home combination or for triple mouse click or for Ctrl + left cursor etc.. Any way it can be done? I've already tried [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool SetCaretPos(int X, int Y); thanks in

How to detect multiline paste in RichTextBox

会有一股神秘感。 提交于 2019-12-02 02:49:37
At the moment I'm working on a simple syntax highlighter and I have couple of problems. Could you help me out? I have a class library with a component class in it. Everything is in VB.NET. It's only one file so you can see it here https://gist.github.com/2366507 . On line 92, there is the OnTextChanged Sub. I was thinking about adding ProcessAllLines() (as on line 128) to the end of that Sub, and it worked. However when I was typing in code to the RichTextBox (source which I used is here https://gist.github.com/2366526 ) after each text change it was checking and processing ALL the lines. So I

Unexpected result of RTF line ending conversion

倖福魔咒の 提交于 2019-12-02 02:35:48
If txtLog is a RichTextBox control: Dim text = "hi" & vbCrLf Debug.WriteLine("t:" & text.Length) ' --> 4, as expected txtLog.Text = text Debug.WriteLine("tL:" & txtLog.TextLength) ' --> 3. muh?! :( Having looked at the RTF spec , the end of a paragraph is notated as \par , which is neither CR nor LF . This makes sense since RTF is markup language; like in HTML, line endings have little meaning on their own. So presumably, on writing into the RichTextBox , my line ending is being encoded into \par . And then, on extraction, the \par is being translated back to a real line ending for use. It

Decide FontStyle (Bold, Italic, Underlined) for RichTextBox

风流意气都作罢 提交于 2019-12-02 02:25:31
问题 How exactly do you change the Font in a RichTextBox? Looking around gives me old answers that doesn't seem to work any more. I thought it would be as simple as doing richtextbox1.Font = Font.Bold; or something similar. Turns out it's not, so I looked around. Apparently you have to change the FontStyle which is a readonly (??) property, but you have to do it making a new FontStyle Object. But even then that doesn't work o.o How do you do this? EDIT: Doesn't seem to work :\ rssTextBox.Document

A WPF RichTextBox + Button in a StackPanel => what a mess?

ⅰ亾dé卋堺 提交于 2019-12-02 02:08:56
This code: <StackPanel Orientation="Horizontal"> <RichTextBox /> <Button Content="Dialog" /> </StackPanel> shows the button somewhere on the left side of the StackPanel ONTO the RichTextBox, WHY? edit: Oh I just saw its a width problem. The RTB has nearly no width and the button is righthand of it. edit: seems I run into this bug: WPF RichTextBox with no width set solution does not work for me! You'd be better off using a Grid and the HorizontalAlignment (and VerticalAlignment) properties of the RTB. <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Grid.ColumnDefinitions>