richtextbox

How to set scroll position of rich text box control?

痞子三分冷 提交于 2019-12-13 16:08:31
问题 I am using 2 Rich Text Boxes on winforms 4 (customRTB1 and customRTB2). Both of the rtb's have same text. What I want to achieve is, when one rtb (customRTB1) is scrolled down, the other rtb (customRTB2) also should be scrolled to exactly same position as customRTB1. I attempted this: public class CustomRTB : RichTextBox { #region API Stuff [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern int GetScrollPos(IntPtr hWnd, int nBar); [DllImport("user32.dll")] public static

Add accent marks with custom colors in .Net's RichTextBox

 ̄綄美尐妖づ 提交于 2019-12-13 15:25:35
问题 Using the Text property of a WinForms' RichTextBox, you can show a letter with an accent above it, in a way that the letter is one character, and the accent is another one. I.e., also visually it looks like one character, it actually consists of two. In Unicode terms, the letter is called a 'base character', while the accent is called 'combining diacritical mark'. I have tried to show a normal black letter with an accent in different color above it (lets say red). Here is the code in VB: 'Box

How can I insert an image into a WPF RichTextBox at runtime in between text so the text floats around the image

江枫思渺然 提交于 2019-12-13 13:28:58
问题 I am trying to insert an image into a WPF RichTextBox at runtime in between text so the text floats around. I tried using a floater but the end result is that only one line can be set next to the image and the rest of the content shifts to the bottom. This is the code I have so far for inserting the image: private Image SelectImage() { CommonDialog dialog = new CommonDialog(); dialog.InitialDirectory = System.Environment.SpecialFolder.MyDocuments.ToString(); dialog.Filter.Add( new FilterEntry

C# copy function richtextbox with formatting [closed]

你。 提交于 2019-12-13 11:21:07
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . How do I make a button that allows me to copy like the ctrl+c function. I want to select a part of a rich text box and when the button is clicked it copies the selected part. With formatting! 回答1: On button click event you should do something like: if (richTextBox1.SelectionLength > 0) // Copy the selected text

How to extract last word in richtextbox in c#

亡梦爱人 提交于 2019-12-13 09:48:52
问题 I am working with windows form. In my project i need to color the last word of rich text box. When someone write on the given text box of the application i need the last word that is just written on the richtextbox to be colored red or whatever. I found a way to extract the last word from the following link http://msdn.microsoft.com/en-us/library/system.windows.documents.textselection.select%28v=vs.95%29.aspx But i need more handy code to extract the last word if its possible. Please help.

Auto Indent when a new line is made [closed]

一曲冷凌霜 提交于 2019-12-13 09:27:27
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm working on a school project which is a HTML Editor. Right now, I've a problem on how to make an auto indentation whenever I make a new line. The spacing of indentation would be the same as the line above it. I hope my problem clear enough. private void richTextBox1_KeyDown(object sender, KeyEventArgs e) { if

Remove richtextbox SelectionBackColor [duplicate]

ⅰ亾dé卋堺 提交于 2019-12-13 08:48:48
问题 This question already has answers here : C# RichTextBox Remove Custom SelectionBackColor (2 answers) Closed 2 years ago . How can I change SelectionBackColor of richtext box to "no color"? I tried these: Color.FromArgb(0, 255, 255, 255); Color.Empty; Color.White; Color.Transparent; But they are all return same result: Color.White !!! For more description, change richtextbox backcolor to some color like pink, then change SelectionBackColor to red, now, try to remove SelectionBackColor , you

WPF FlowDocument :: How Can I Define Custom Templates for the Child Paragraph, Run, etc

我与影子孤独终老i 提交于 2019-12-13 06:52:37
问题 I'm fairly new to WPF, so please bear with me. I am trying to customize the presentation of the various elements of a FlowDocument in a RichTextBox (RTB). WPF controls are lookless, so as I understand it I should be able to define the look for every child in the Document . Would I define the template for this in the RTB? Separate templates for each item ( Paragraph , Section , Run , etc) as resources? Let's say, for sake of argument, that I want a red border around every Section , the word

Remove the ability to resize an image pasted into a richtextbox and add an event to that image. C#

匆匆过客 提交于 2019-12-13 06:44:58
问题 I have searhed high and low for a solution to this problem. I have no problem adding an Bitmap image into the richtextbox. The problem is that I don't want it to have the resize option to it. I want that one image to be SELECTED when I click on it, just like in most messengers, and to throw an onclick event. Any help in this area would be greatly appreciated. 回答1: Here is a question about inserting an image manually building the RTF code. I suspect for any sort of custom functionality you

Send scroll event to form

百般思念 提交于 2019-12-13 06:36:21
问题 In my windows forms application it occurs frequently that a user scrolls through a panel and is then blocked by a richtextbox . I would like to catch the scroll event and send it to the panel when the richtextbox vertical scrollbar is not visible. I already found the code to check if the vertical scrollbar is visible in this thread: https://social.msdn.microsoft.com/Forums/en-US/a3facad3-0eae-4610-9a63-1b6c7a718bf5/how-do-you-determine-if-vertical-scroll-bar-is-visible-in-richtextbox?forum