richtextbox

WPF RichTextBox: How to change selected text font?

为君一笑 提交于 2019-11-27 06:22:57
问题 how can I change the font for a currently selected text area inside a WPF RichTextBox? 回答1: I've implemented a toolbar that can change the font size, family, color, etc. What i found is the details can be tricky with the wpf richtextbox. Setting the selection font makes some sense, but, there are also the default font properties of the text box, and the current caret properties to contend with. Here is what i've written to get it to work for most cases with the font size. The process should

Get current scroll position from rich text box control?

这一生的挚爱 提交于 2019-11-27 05:28:57
I have searched the internet far and wide and seen many questions like this, but I have not seen an actual answer. I have a rich text box control with lots of text in it. It has some legal information in this control. By default the "Accept" button is disabled. I want to detect on the scroll event if the position of the v-scroll bar is at the bottom. If it is at the bottom, enable the button. How would I detect the current v-scroll bar position? Thank You! EDIT I am using WinForms (.Net 4.0) This should get you close to what you are looking for. This class inherits from the RichTextBox and

How To Output Shell Command To a RichTextBox In Visual Basic

拥有回忆 提交于 2019-11-27 04:57:59
问题 I've been struggling with this all week so I'm hoping the experts here can help me out. I have an executable that absolutely must be run from the command line with arguments. What I'm trying to do is instead of launching the command prompt window, I'd like to send the data to the rich text box on my form. If I setup a batch file and run the batch file with the correct code (running it as a Process ), this works no problem. However, I'd like for the user to be able to enter their own arguments

C#: Synchronize Scroll Position of two RichTextBoxes?

旧街凉风 提交于 2019-11-27 04:49:58
In my application's form, I have two RichTextBox objects. They will both always have the same number of lines of text. I would like to "synchronize" the vertical scrolling between these two, so that when the user changes the vertical scroll position on one, the other scrolls the same amount. How might I go about doing this? I did this for a small project a while ago, and here's the simplist solution I found. Create a new control by subclassing RichTextBox: public class SynchronizedScrollRichTextBox : System.Windows.Forms.RichTextBox { public event vScrollEventHandler vScroll; public delegate

How do you prevent a RichTextBox from refreshing its display?

♀尐吖头ヾ 提交于 2019-11-27 04:41:12
I have a RichTextBox where I need to update the Text property frequently, but when I do so the RichTextBox "blinks" annoyingly as it refreshes all throughout a method call. I was hoping to find an easy way to temporarily suppress the screen refresh until my method is done, but the only thing I've found on the web is to override the WndProc method. I've employed this approach, but with some difficulty and side effects, and it makes debugging harder, too. It just seems like there's got to be a better way of doing this. Can someone point me to a better solution? puch4tek Here is complete and

How to use multi color in richtextbox [duplicate]

南楼画角 提交于 2019-11-27 04:32:23
This question already has an answer here: Color different parts of a RichTextBox string 8 answers I using C# windows forms and I have richtextbox and I want to color some text in red, some in green and some in black. How to do so? Image attached. System.Windows.Forms.RichTextBox has got a property of type Color of the name SelectionColor which gets or sets the text color of the current selection or insertion point. You can use this property to mark specific fields in your RichTextBox with the colors you specify. Example RichTextBox _RichTextBox = new RichTextBox(); //Initialize a new

What is the best rich textarea editor for jQuery? [closed]

故事扮演 提交于 2019-11-27 04:09:05
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Something like this one on the Stackoverflow site would be nice! Or something non-jQuery that doesn't conflict with jQuery $() tags

Substract Flag From FontStyle (Toggling FontStyles) [C#]

感情迁移 提交于 2019-11-27 03:24:52
问题 I have a little problem. I have one 1 RichTextBox and 2 Buttons. I have that 2 buttons for "toggle Bold FStyle" and "toggle Italic FStyle". I want to toggle FontStyles without affecting other FontStyles. I hope you understand me. Below code works when combining FontStyles but is not working when seperating/substracting FontStyles . private void button1_Click(object sender, EventArgs e) { richTextBox1.SelectionFont = new Font(richTextBox1.Font, (richTextBox1.SelectionFont.Bold == false ?

How to change the background color of a rich text box when it is disabled?

核能气质少年 提交于 2019-11-27 03:16:00
问题 Whenever I set the RichTextBox.Enabled property to false, its background color is automatically set to gray as it is set to the color in system color which is set in the control panel. How can I change its color to black even if I set it to disabled? 回答1: See: How to change the font color of a disabled TextBox? [Edit - code example added] richTextBox.TabStop = false; richTextBox.ReadOnly = true; richTextBox.BackColor = Color.DimGray; richTextBox.Cursor = Cursors.Arrow; richTextBox.Enter +=

Rich Text box scroll to the bottom when new data is written to it

ぐ巨炮叔叔 提交于 2019-11-27 02:29:19
问题 My program calls Java and then redirects stdout to a RichTextBox . My problem is that the vertical scrollbar always stays at the top of the box every time data is written. Even if you scroll to the bottom, once new data has been written it goes to the top. I would like the opposite. So when new data is written, it stays at the bottom. How can I do this? 回答1: Yes, you can use the ScrollToCaret() method: // bind this method to its TextChanged event handler: // richTextBox.TextChanged +=