Click here to Skip to main content
15,905,419 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
Could anyone help me how to zoom text in a rich edit control in MFC.
I would appreciate any kind of help.
Thanks in advance.

1 solution

Hello Devadutta,

when the focus is on the RichTextBox control hold down the control key and use the scroll button on your mouse. This way you'll be able to zoom in and out, making the text bigger or smaller as you wish.

Oh no: I've been reading too superficially again. Solution below is
for WinForm and not MFC as requested. (Shame on me)

Start of modification

If you'd like to do it code wise:

public partial class Form1 : Form
    public Form1()

    private void trackBar1_Scroll(object sender, EventArgs e)
        float factor = (float)trackBar1.Value / 10;
        richTextBox1.ZoomFactor = factor;

The form contains a TrackBar and a RichTextBox control. The TrackBar has a Maximum of 40 and a Minimum of 1. Via the calculation in the Scroll event handler the zoom factor is effectively set to anything from one thenth (0.1) up to 4.0. Of course you can choose your own values as you please ;) .

End of Modification


Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900