放大/缩小MFC中RichEditControl中的文本 [英] Zoom in/zoom out text in RichEditControl in MFC

查看:259
本文介绍了放大/缩小MFC中RichEditControl中的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
谁能帮助我如何在MFC中的丰富编辑控件中缩放文本.
我将不胜感激.
提前谢谢.
Dev.

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.
Dev.

推荐答案

Hello Devadutta,

当焦点位于RichTextBox控件上时,请按住Control键并使用鼠标上的滚动按钮.这样,您就可以放大和缩小,使文本随心所欲地变大或变小.

哦,不:我再读一次也太肤浅了.下面的解决方案是
WinForm而不是MFC的请求. (对我感到羞耻)


开始修改

如果您想在代码方面做到明智:

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()
    {
        InitializeComponent();
    }

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



该窗体包含一个TrackBar和RichTextBox控件. TrackBar的最大值为40,最小值为1.通过Scroll事件处理程序中的计算,缩放系数实际上设置为从十分之一(0.1)到4.0的任何值.当然,您可以根据需要选择自己的值;).

修改结束

问候

曼弗雷德(Manfred)



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

Greetings

Manfred


这篇关于放大/缩小MFC中RichEditControl中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆