4

I am trying to perform edit functions in a RichTextBox on a C# (Windows Forms) application. I would like to be able to select any number of text characters in the script then change targeted font characteristics.
The trouble I have is that each characters font properties may be set to different font. In this case the textbox ignores the event that I request.

How can I solve my problem?

VMAtm
  • 27,943
  • 17
  • 79
  • 125
user1051434
  • 167
  • 1
  • 5
  • 17
  • I haven't found a solution to that problem either, so I had to scan the selection one character at a time to find chunks with all the same font properties and change the size of each of those chunks. So I'm hoping that better answers emerge here! – Mr Lister Nov 30 '12 at 10:16
  • See [Changing font for richtextbox without losing formatting](http://stackoverflow.com/a/16307021/719186) – LarsTech May 10 '13 at 14:02

2 Answers2

1

Take a look at this: Changing font for richtextbox without losing formatting

I think it's the same issue. LarsTech's solution is working perfectly for me.

Community
  • 1
  • 1
Jerry
  • 4,258
  • 3
  • 31
  • 58
-2

I have a code to change the size:

RichTextBox1.Font.Size == new System.Drawing.Font(RichTextBox1.Font.Name, yoursize)

And if you want to change only the selected text size:

RichTextBox1.SelectionFont.Size == new System.Drawing.Font(RichTextBox1.SelectionFont.Name, yoursize)

Hope it will help.

Benjli
  • 125
  • 2
  • 13