richtextbox

How do I .MatchCase and .WholeWord?

五迷三道 提交于 2019-12-08 05:22:55
问题 Ive been making a find, find next function for my richtextbox, so I have these check boxes to let the user search by whole word or case sensitive or both, and I got the first two, to work but I can't get it to work with both case a whole word checked, here's my code: if (isWhole == true && isCase == true) { string searchText = Form2.text; this.Focus(); richTextBox1.Focus(); findPos = richTextBox1.Find(searchText,findPos,richTextBox1.Text.Length, RichTextBoxFinds.WhatGoesHere?); richTextBox1

Change link color in RichTextBox

孤街浪徒 提交于 2019-12-08 04:08:56
问题 I have a RichTextBox which contains links posted by the users. The problem is that my RTB makes the color of the links black, and the background color is also black. This leads to the links being invisible. How do I change the color of the links in the RTB? 回答1: Phoexo: Have a look at the following CodeProject article. This fellow provides a way to create arbitrary links in the text that work, while the DetectUrls property is set to false . With a small amount of hacking, you should have full

changing the colour of certain characters and count in RichTextBox

旧巷老猫 提交于 2019-12-08 03:20:37
问题 i have to count the number of a certain character in a C# richtextbox (namely: "K"). but i also want to give that character a colour in the rich text box when a button is pressed. in short, i'm in a bind, any help is appreciated. p.s: i tried googleing it but couldn't find a statisfactory solution. my thanks in advance. 回答1: Here is code example: private void ColorTheKs() { for(int i = 0; i< richTextBox1.Text.Length; i++) { if (richTextBox1.Text[i] == 'K') { richTextBox1.SelectionStart = i;

Inserting at top of richtextbox

守給你的承諾、 提交于 2019-12-08 02:15:23
问题 Whats wrong with this code? Trying to get my text to insert at the beginning of the textbox rather than at the bottom. private void execute_Click(object sender, EventArgs e){ startFinshBox.Text = "Start Time: " + printTime()+""; startFinshBox.Text.Insert(0,printTime()+": Retrieving Results...\n"); } But it will not insert the second line into the rtb. I have tried with startFinishBox.SelectionStart = 0 as well, and it made no difference. Am I missing something else? Thanks, Psy 回答1:

Changing an extended RichTextBox text in constructor doesn't work

我的未来我决定 提交于 2019-12-08 01:38:42
问题 I have the following class: public partial class RichTextBoxEx : RichTextBox { public RichTextBoxEx() { InitializeComponent(); Text = "Some Text"; } } However, when I place it over a form and run the program, the RichTextBox is empty. What is the problem and how can I fix it? I assume there is something basic I'm missing here, but I cannot figure out what, and I did not manage to find any information about this. 回答1: The property values which you set in constructor of the control are usually

Extended WPF Toolkit RichTextBox display text vertically

こ雲淡風輕ζ 提交于 2019-12-07 16:06:59
问题 I'm trying to bind a rich content (RTF format) to a rich text box (of Extended WPF Toolkit) via its Text property like this <extToolkit:RichTextBox x:Name="rtbKIContent" Margin="8,8,8,8" IsEnabled="{Binding IsEditable}" Text="{Binding Content}"> <extToolkit:RichTextBox.TextFormatter> <extToolkit:RtfFormatter></extToolkit:RtfFormatter> </extToolkit:RichTextBox.TextFormatter> <extToolkit:RichTextBoxFormatBarManager.FormatBar> <extToolkit:RichTextBoxFormatBar /> </extToolkit

WinForm richtextbox deep line spacing and character spacing

走远了吗. 提交于 2019-12-07 13:02:28
问题 How to edit line spacing and character spacing on richtextbox in winform? I've tried PARAFORMAT2 but it does not allow deep setting. I want to set spacing like photoshop. For example; In the picture is three different spacing format. How to set spacing like 1,2,3 in the picture? 回答1: Line Spacing You can send EM_SETPARAFORMAT message to the rich text box control and pass PARAFORMAT2 as lparam . To control line spacing, you should set the PFM_LINESPACING flag in the dwMask member and set

Change line spacing in winform RichTextBox

Deadly 提交于 2019-12-07 11:48:01
问题 I'm using in my winform project a RichTextBox control to display a kind of old console screen. This works perfectly but there is a space between the lines. Is it possible to change this space to be 0 or anything near that. If i paint a line from vetical line from line 1 to line 5 i don't want any spacing between the line. Hope you can help me. 回答1: There's actually a lot that the Windows Forms RichTextBox doesn't expose. If you have the HWND (Handle property) to the control, you can use the

In C#, Loading large file into winform richtextbox

放肆的年华 提交于 2019-12-07 11:40:53
问题 I need to load a - 10MB range text file into a Winform RichTextBox, but my current code is freezing up the UI. I tried making a background worker do the loading, but that doesnt seem to work too well either. Here's my several loading code which I was tried. Is there any way to improve its performance? Thanks. private BackgroundWorker bw1; private string[] lines; Action showMethod; private void button1_Click(object sender, EventArgs e) { bw1 = new BackgroundWorker(); bw1.DoWork += new

Disable the selection highlight in RichTextBox or TextBox

荒凉一梦 提交于 2019-12-07 08:15:34
问题 How can I disable the selection highlight of RichTexBox or TextBox in my Windows Forms Application as shown in the image. I need to change selection highlight color from Blue to White , because I need to hide selection in TextBox or RichTextBox all the time. I tried to use RichTextBox.HideSelection = true , but it doesn't not work as I expect. 回答1: You can handle WM_SETFOCUS message of RichTextBox and replace it with WM_KILLFOCUS. In the following code, I've created a ExRichTextBox class