Reputation: 253
I have a richtextbox. When I'm holding control and spin the scroll wheel, the text size is changing.
But how do I get the text size after changing it by ctrl + scroll? RichTextBox1.Font.Size
is always 8.25.
Google did not help.
Upvotes: 2
Views: 1130
Reputation: 11
Use this code:
private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
float zoom = richTextBox1.ZoomFactor;
if ((zoom * 2 < 64) && (zoom / 2 > 0.015625))
{
if (e.KeyCode == Keys.Add && e.Control)
{
richTextBox1.ZoomFactor = zoom * 2;
}
if (e.KeyCode == Keys.Subtract && e.Control)
{
richTextBox1.ZoomFactor = zoom / 2;
}
}
}
Upvotes: 1
Reputation: 29451
What you're looking for is the ZoomFactor
of RichTextBox:
Gets or sets the current zoom level of the RichTextBox.
That's why you don't see the font size change.
Upvotes: 3