Browse by Tags
All Tags » Using Controls » RichTextBox (RSS)
Sorry, but there are no more tags available to filter with.
-
|
The Rich Text Format (RTF) Specification, version 1.6 is available in the MSDN Library. Contributed from George Shepherd's Windows Forms FAQ
|
-
|
There is no direct support for printing rich text in the .NET Framework. To print it, you can use interop with the SendMessage API and these three messages to do your printing. EM_SETTARGETDEVICE : specify the target device EM_FORMATRANGE : format part...
|
-
|
If you visit the selection a character at the time, you can get the current FontStyle and modify it directly to add or remove a style like Bold or Italic. Doing it a character at a time will avoid losing the other styles that are set. The problem with...
|
-
|
To add a hyperlink to the RichTextBox, so that it opens up the link you click on, ensure that DetectUrls property is set to true and call: [C#] private void richTextBox1_LinkClicked(object sender, LinkClickedEventArgs e) { System.Diagnostics.Process.Start...
|
-
|
You use the LoadFile method of the RichTextBox, passing it a StreamReader based on the resource. So include your RTF file as an embedded resource in your project, say RTFText.rtf. Then load your RichTextBox with code such as Stream stream = GetType()...
|
-
|
There are a couple different methods that can be used here. The first changes focus, so may not be possible if you have controls that fire validation. The second uses interop, which requires full trust. Method 1: The RichTextBox control contains a Lines...
|
-
|
One way to do this is to use the RichTextBox.SaveFile method. private void button1_Click( object sender, EventArgs e ) { // get a file name from the user SaveFileDialog saveFile1 = new SaveFileDialog(); saveFile1.DefaultExt = "*.rtf"; saveFile1...
|
-
|
Use the Rtf property of the control. richTextBox1.Rtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl {\f0\fswiss\fcharset0 Arial;}}\viewkind4\uc1\pard\b\i\f0\fs20 This is bold italics.\par }"; Contributed from George Shepherd's Windows...
|
-
|
You must set the AllowDrop property on the RichTextBox control to true, and also handle both the DragEnter and DragDrop events. Add event handlers to the control: [C#] using System.Windows.Forms; richTextBox1.DragEnter += new DragEventHandler( richTextBox1_DragEnter...
|
-
|
You use the SelectionFont and SelectionColor properties. Make sure the control had focus. Then the following code will set the currently selected text to a red-bold-courier font. If no text is currently selected, then any new text typed (or inserted)...
|
-
|
There is an XHTML RichTextBox sample on the WindowsForms.net website. See the RichTextBox that Displays XHTML item in the Controls section on the WindowsForms.net Samples page .
|