richtextbox

Set RTF text into WPF RichTextBox control

梦想与她 提交于 2019-12-03 04:12:06
问题 I have this RTF text: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}} {\colortbl ;\red0\green0\blue0;\red255\green0\blue0;} \viewkind4\uc1\pard\qc\cf1\fs16 test \b bold \cf2\b0\i italic\cf0\i0\fs17 \par } How to set this text into WPF RichTextBox? Solution: public void SetRTFText(string text) { MemoryStream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(text)); this.mainRTB.Selection.Load(stream, DataFormats.Rtf); } Thanks for help from Henk Holterman.

“Object library not registered” when adding Microsoft Rich Textbox Control 6.0 (SP6)

北城余情 提交于 2019-12-03 03:05:07
问题 I try to add Microsoft Rich Textbox Control 6.0 (SP6) control via Project -> Components... in VB6 IDE. The control is present in the list of controls. When I tick it and click OK/Apply, I get Object library not registered error: Environment is Windows 7 SP1 x64 with latest updates, VB6 SP6 + KB957924. richtx32.Ocx is present in C:\Windows\SysWOW64\ . I tried re-registering .ocx by running this in elevated command prompt: cd c:\windows\SysWOW64 regsvr32 /u richtx32.Ocx regsvr32 richtx32.Ocx

How do online rich text editors work?

末鹿安然 提交于 2019-12-03 02:34:15
I was wondering how online rich text editors maintain the formatting when you paste text from a webpage or document. A standard textarea box only takes text while these WYSIWYG editors seem to use a DIV. How does it work? Online rich text editors use contentEditable or designMode to take advantage of the browser's native support for HTML editing. When you paste into a contentEditable or designMode element, the browser puts HTML directely into the element. Try it yourself by pasting into Midas Demo and then using Firebug's inspect element to look at the HTML you pasted. JavaScript applications

How to show number of a line in a RichTextBox C#

倾然丶 夕夏残阳落幕 提交于 2019-12-02 23:50:52
I am making a simple text and script editor with code highlighting. For that I use a RichTextBox. But I don't know how to make it show the lines' numbers on the left side, like in VS or Notepad++. Is there any solution? Cheeso I tried re-using the code from the codeproject articles referenced elsewhere, but every option I looked at, seemed a bit too kludgy. So I built another RichTextBoxEx that displays line numbers. The line numbering can be turned on or off. It's fast. It scrolls cleanly. You can select the color of the numbers, the background colors for a gradient, the border thickness, the

WPF RichTextBox appending coloured text

独自空忆成欢 提交于 2019-12-02 22:28:18
I'm using the RichTextBox.AppendText function to add a string to my RichTextBox . I'd like to set this with a particular colour. How can I do this? Kishore Kumar Just try this: TextRange tr = new TextRange(rtb.Document.ContentEnd,­ rtb.Document.ContentEnd); tr.Text = "textToColorize"; tr.ApplyPropertyValue(TextElement.­ForegroundProperty, Brushes.Red); If you want, you can also make it an extension method. public static void AppendText(this RichTextBox box, string text, string color) { BrushConverter bc = new BrushConverter(); TextRange tr = new TextRange(box.Document.ContentEnd, box.Document

jQuery plugin that suggests/autocompletes within a textarea [closed]

こ雲淡風輕ζ 提交于 2019-12-02 18:33:52
Is there a jQuery plugin that suggests/autocompletes within a textarea? What I want is to have suggested words or autocompleted text proffered to the user in a textarea like the example image below: Breezer Well there is the autocomplete plugin that does just that, and if you want to pull data from a database I recomment using the ajax API that is included in jQuery. something like this $('textarea').keyup(function(){ $.post('ajax/test.php', function(data) { $('#example').autocomplete(data); }); }); Also remember this is just the basic structure to give you an idea. P.S. I just found this it

Set RTF text into WPF RichTextBox control

我的梦境 提交于 2019-12-02 17:28:47
I have this RTF text: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}} {\colortbl ;\red0\green0\blue0;\red255\green0\blue0;} \viewkind4\uc1\pard\qc\cf1\fs16 test \b bold \cf2\b0\i italic\cf0\i0\fs17 \par } How to set this text into WPF RichTextBox ? Solution: public void SetRTFText(string text) { MemoryStream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(text)); this.mainRTB.Selection.Load(stream, DataFormats.Rtf); } Thanks for help from Henk Holterman. Do you really have to start with a string? One method to load RTF is this: rtfBox.Selection.Load

“Object library not registered” when adding Microsoft Rich Textbox Control 6.0 (SP6)

允我心安 提交于 2019-12-02 16:37:42
I try to add Microsoft Rich Textbox Control 6.0 (SP6) control via Project -> Components... in VB6 IDE. The control is present in the list of controls. When I tick it and click OK/Apply, I get Object library not registered error: Environment is Windows 7 SP1 x64 with latest updates, VB6 SP6 + KB957924. richtx32.Ocx is present in C:\Windows\SysWOW64\ . I tried re-registering .ocx by running this in elevated command prompt: cd c:\windows\SysWOW64 regsvr32 /u richtx32.Ocx regsvr32 richtx32.Ocx Registration completes successfully, but doesn't resolve the problem. When I look at what's going on

How to make a specific part of string Bold on richTextBox?

与世无争的帅哥 提交于 2019-12-02 16:06:21
问题 I have a chat application that is based on a Form and 2 richTextBoxes ! richTextBox1 is used to display all conversation richTextBox_TextToSend is used to type in the message to send when a user types a message and hit the enter button, the entered text will appear in richTextBox1 private void button1_Click(object sender, EventArgs e) { // insert message to database if(richTextBox_TextToSend.TextLength>0) { string txt = richTextBox_TextToSend.Text; // send the typed message sendMessage(from

convert RTF to HTML from ComponentOne RichTextBox?

谁都会走 提交于 2019-12-02 15:29:11
问题 The section Read and Write Rich Text Format Documents of this online article of UWP edition of ComponentOne reads: you can use it to convert RTF to HTML and vice versa. I went through their API document and did not find any code example of such functionality and could not figure out which method from their APIs to use. Question : Could you please provide (or link to an online sample) for converting RTF to HTML from RichTextBox control of ComponentOne's UWP Edition? I'm using C# but VB code