Tag Archives: RichTextBox

Display subscripts and superscripts in a RichTextBox in C#, version 2

The following examples show how to display subscripts and superscripts in a RichTextBox. Display subscripts and superscripts in a RichTextBox in C# Easily display subscripts and superscripts in a RichTextBox in C# Those were fairly simple examples, and Sudhir Srivastava … Continue reading

Posted in fonts, formatting | Tagged , , , , , , , , , , , , , | Leave a comment

Find the word under the mouse in a RichTextBox control in C#

The following WordUnderMouse method returns the word under the mouse in a RichTextBox. // Return the word under the mouse. private string WordUnderMouse(RichTextBox rch, int x, int y) { // Get the character’s position. int pos = rch.GetCharIndexFromPosition(new Point(x, y)); … Continue reading

Posted in controls, miscellany | Tagged , , , , , , , , , , , | 2 Comments

Easily display subscripts and superscripts in a RichTextBox in C#

The example Display subscripts and superscripts in a RichTextBox in C# requires you to make arrays holding the positions of the characters that should be subscripts and superscripts. That’s not a big deal but it does require you to count … Continue reading

Posted in fonts, formatting | Tagged , , , , , , , , , , , , , , , | 3 Comments

Display subscripts and superscripts in a RichTextBox in C#

A TextBox can only use a single font at a time so it can’t display subscripts and superscripts, but a RichTextBox can do it. Simply use the control’s Select method to select the text that should be a subscript or … Continue reading

Posted in fonts, formatting | Tagged , , , , , , , , , , , , , | 2 Comments

Set RichTextBox tab stops in C#

You can set different RichTextBox tab stops for different parts of a RichTextBox control’s text. This example uses the following code to set tabs for the whole control and then adds some text to it that includes tabs. // Set … Continue reading

Posted in controls | Tagged , , , , , , , , , , , , , , | Leave a comment

Format text in a RichTextBox in C#

To format text in a RichTextBox, use the control’s Select method to select the text. Then use the “Selection” properties (SelectionAlignment, SelectionBackColor, SelectionFont, etc.) to set the properties for the selected text. This example uses the following code to format … Continue reading

Posted in controls | Tagged , , , , , , , , , , , | 2 Comments

Make a notepad application that uses encryption in C#

The example Make a password manager in C# shows how you can use encryption to manage passwords safely. This example uses a much simpler approach, although it provides fewer features. This program lets you save information in a RichTextBox into … Continue reading

Posted in algorithms, cryptography, mathematics, tools | Tagged , , , , , , , , , , , , , , | Leave a comment