How preserve fontsize of 2 Richtextbox or equal sizes

A R C 1 Reputation point
2021-06-09T07:03:03.237+00:00

I have 2 richtextboxes, I increase the font size of both correctly at same time with a button with this code. The problem is: when I zoom directly on touchscreen and/or I do accidentally 2-fingered zoom on the touchpad, over one of them, it zooms too, but then I can't get back equal values pressing the button, both textboxes get diferent font size. Clicking the button continues to increase 1 point each text, but at different sizes, I must adjust manually, (doing zoom again in the same way at 2 fingers) to get back the nearest size in the moddified one.

  1. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  2. RichTextBox1.Font = New Font(RichTextBox1.Font.FontFamily, RichTextBox1.Font.Size + 1,RichTextBox1.Font.Style)
  3. RichTextBox2.Font = RichTextBox1.Font
  4. End Sub
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,714 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.