如何使用修复大小调整文本大小只是更改文本高度? [英] How to resize text with fix size just change text height?

查看:133
本文介绍了如何使用修复大小调整文本大小只是更改文本高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我想更改动态字体大小,但只需更改高度,应该是文本的固定宽度。



字体font3 =新字体(Times New Roman,(int)(15),FontStyle.Bold,GraphicsUnit.Pixel);

graphics.DrawString( A,font2,新的SolidBrush(Color.FromArgb(0,0,0)),60,240,sf);



我无法分开控制(只是高度)的文字。



我尝试过:



Font font3 = new Font(Times New Roman,(int)(15),FontStyle.Bold,GraphicsUnit.Pixel);

graphics.DrawString(A,font3,new SolidBrush (Color.FromArgb(0,0,0)),60,240,sf);

Hello,

I want to change the dynamic font size, but just change the height and should be fixed width of the text.

Font font3 = new Font("Times New Roman", (int)(15), FontStyle.Bold, GraphicsUnit.Pixel);
graphics.DrawString("A", font2, new SolidBrush(Color.FromArgb(0, 0, 0)), 60, 240, sf);

I can't separate control (just height) on the text.

What I have tried:

Font font3 = new Font("Times New Roman", (int)(15), FontStyle.Bold, GraphicsUnit.Pixel);
graphics.DrawString("A", font3, new SolidBrush(Color.FromArgb(0, 0, 0)), 60, 240, sf);

推荐答案

执行此操作的一种方法是将字体渲染为中间位图,然后缩放位图的高度。然后将其渲染到您的显示器中。
One way to do this would be to render the font into an intermediate bitmap and then scale the height of the bitmap. This would then be rendered into your display.


这篇关于如何使用修复大小调整文本大小只是更改文本高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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