richtextbox

C1RichTextBox with custom copy/paste behavior

我们两清 提交于 2019-12-01 08:42:06
问题 When using C1RichTextBox in Silverlight 5 with IE 10, I am facing two major issues: During a clipboard paste operation, how can I detect if the content was copied from another C1RichTextBox in my Silverlight application or from an external application? From external applications, only text should be pasted without formatting. Copy/Pasting large inline images from one C1RichTextBox to another does not work. The <img> elements have the image content stored in their data URL. If the image

How to show cursor in unfocused WinForms TextBox/RichTextBox?

我的未来我决定 提交于 2019-12-01 08:40:50
I need to show cursor in RichTextBox control in WinForms application even when it's not in focus. How can I do this? I found only the way for WPF ( How to keep WPF TextBox selection when not focused? ) You can use WinAPI .. [DllImport("user32.dll", EntryPoint = "ShowCaret")] public static extern long ShowCaret(IntPtr hwnd); [DllImport("user32.dll", EntryPoint = "HideCaret")] public static extern long HideCaret(IntPtr hwnd); and call ShowCaret whenever you want You can't set focus to the two or more UI at same time however you can preserve the selection by setting HideSelection=false . I don't

Fastest way to append text to a richtextbox?

那年仲夏 提交于 2019-12-01 08:29:57
I have a application with a RichTextBox control where a procedure is adding text almost all the time: RichTextBox1.Text += vbNewLine & "Title: " & AlbumName RichTextBox1.Text += vbNewLine & "Genre: " & AlbumGenre RichTextBox1.Text += vbNewLine & "Year : " & AlbumYear RichTextBox1.Text += vbNewLine & "Url : " & AlbumLink ' The slow thing I think is here: RichTextBox1.SelectionStart = RichTextBox1.Text.Length RichTextBox1.ScrollToCaret The problem is when the richtextbox has about more than 50 lines, when has more lines it turns more slowly to append the new text (obvious). I need to find a

How can I color text in a Rich Textbox in C#? [duplicate]

 ̄綄美尐妖づ 提交于 2019-12-01 08:02:53
Possible Duplicate: C# How can I set the color of text in a richtextbox? In Visual C#.NET, I want to change the color of specific text when it is typed in to a rich text box. For example, I might want to color the world "hi", so when the user is typing in the rich text box, if they type "hi" it would change colors and the word "hi" would be a different color from all the other text in the rich text box. How would I do that? Is there a better way to do that, not in a rich textbox? in your TextChanged Event handler txtRichTextBox.Select(txtRichTextBox.Text.IndexOf("hi"), "hi".Length);

Rich Text in ToolTip for C#

我与影子孤独终老i 提交于 2019-12-01 07:33:49
I can extend the ToolTip and create my own RichToolTip but I don't understand how I can handle formatting per line or Per word. Can I add controls which a user can click on ? or images etc. I came across RichTextBox but this is written in C++ (MFC) & I want something for C# or something which I can use with C#. Any suggestions? Are there any open source components which I can use? public class RichToolTip : ToolTip { public RichToolTip() { this.OwnerDraw = true; this.Draw += new DrawToolTipEventHandler(OnDraw); } public RichToolTip(System.ComponentModel.IContainer Cont) { this.OwnerDraw = true

Show pdf inside silverlight application. PDF to XAML

孤街浪徒 提交于 2019-12-01 06:42:05
I need to create silverlight application where customer will see some pdf files. PDF files have to be inside silverlight control and not rendered as images (customer wants to select text) For this purposes i need some free libriaries or code to convert pdf file to xaml (or just open pdf so i can convert it to xaml). Which library can read pdf and help me to convert data to xaml? Can I read somehow pdf file and write custom convertation tool? I saw iTextSharp. Is this library can read pdf and help me with my issue? I will be thankfull for any ideas or links. I make use of the Acrobat Reader

Using GetLineStartPosition to get the end of a line in WPF RichTextBox

旧街凉风 提交于 2019-12-01 06:37:14
A bit of background. I would like to be able to process text for the line that the caret is on in a WPF RichTextBox. Please see my earlier question about the TextPointer class: How to keep track of TextPointer in WPF RichTextBox? . I know how to get the TextPointer at the start of the current line by using GetLineStartPosition with 0 as the argument but would now like to get the TextPointer at the end of the line. It was suggested in my previous question that this is possible using the GetLineStartPosition method. I would appreciate it if someone can explain a bit about how the

C# How can I paste formatted text from clipboard to the RichTextBox

半世苍凉 提交于 2019-12-01 06:21:51
I added context menu to the richboxtext with only one function "paste". What code will paste my clipboard content (e.g. copied from Microsoft Word) to the richboxtext form? I tried with: private void PasteToolStripMenuItem_Click_1(object sender, EventArgs e) { richTextBox1.Text = Clipboard.GetText(); } but it pastes non-formatted text. How can I paste text with the formatting? Got it! Just specificy the format: richTextBox1.Text = Clipboard.GetText(TextDataFormat.Rtf); UPDATE This will help you get formatted text(text only) from MS Word DataFormats.Format myFormat = DataFormats.GetFormat

Link to File's path with spaces in RichTextBox?

六眼飞鱼酱① 提交于 2019-12-01 06:18:57
问题 I have VS2010, C#. I use RichTextBox in a form. I set the DectectUrls property to True. I set a LinkClicked event. I would like open a file link like this: file://C:\Documents and Settings... or file://C:\Program Files (x86)... It doesn't works for path with spaces. The source code: rtbLog.SelectionFont = fnormal; rtbLog.AppendText("\t. Open Path" + "file://" + PathAbsScript + "\n\n"); // DetectUrls set to true // launch any http:// or mailto: links clicked in the body of the rich text box

Determining the selected InlineUIContainer in a WPF RichTextBox

我怕爱的太早我们不能终老 提交于 2019-12-01 06:18:13
I'd like to determine if there is an InlineUIContainer (or BlockUIContainer) at the current Caret position in a WPF RichTextBox. Currently I have a RichTextBox as follows; <RichTextBox SelectionChanged="RichTextBox_SelectionChanged"> <FlowDocument> <Paragraph> <Run>Some text before</Run> <InlineUIContainer> <Label>I am a label</Label> </InlineUIContainer> <Run>Some text after</Run> </Paragraph> </FlowDocument> </RichTextBox> In the SelectionChanged event I have tried using; rtf.CaretPosition.GetAdjacentElement(rtf.CaretPosition.LogicalDirection) ... which returns null. I can do it using the