1 year ago

#76112

test-img

Thomas853

Listen to RichTextBox.ZoomFactor has changed event

I cannot determine why the ZoomFactor of my Winforms RichTextBox is getting reset to 1.

I checked all calls to Clear() and when setting the Text property and I am aware of the Set-ZoomFactor-twice-bug (Need to set RichTextBox ZoomFactor twice?).

Now I wonder whether there is a way to debug into some ZoomFactor-has-changed-event in order to determine why and how the ZoomFactor is changed automatically.

Any help is highly appreciated.

Edit 1

I can reproduce the reset as follows (at least in my application):

  • Click into empty RichTextBox
  • Increase zoom using Ctrl and mouse wheel
  • Click somewhere else
  • Click into the RichtTextBox again

This suggests that the ZoomFactor is automatically reset if the Text property is empty and the RichTextBox becomes focused, not just when calling Clear(). Could this be the reason?

Edit 2

I could not reproduce the effect using a new Winforms example project and the above procedure. This means, I have to look for some side effects in my application.

Edit 3

The ZoomFactor has been reset due to an overlooked Text = <empty string>. It is working now.

c#

.net

winforms

richtextbox

0 Answers

Your Answer

Accepted video resources