使用C#从底部到顶部方向绘制文本. [英] Drawing text in bottom to top direction using c#.?

查看:135
本文介绍了使用C#从底部到顶部方向绘制文本.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试使用图形对象的drawstring方法在图像上绘制文本.

我正在使用以下代码在垂直方向绘制字符串

在我的代码中,我使用的是命名空间: 使用System.Drawing;

StringFormat formatver =新的StringFormat(StringFormatFlags.DirectionVertical);

但是文本是从上到下.
我想将此字符串从下到上打印.

请指导我.

谢谢
venkat.

Hi,

I am trying to draw text on image using drawstring method of graphics object.

I am using below code to draw the string in vertical

In my code i am using the namespace: using System.Drawing;

StringFormat formatver = new StringFormat(StringFormatFlags.DirectionVertical);

But the text is coming from Top to Bottom.
I want to print this string from Bottom to Top.

Please guide me..

Thanks
venkat.

推荐答案

如果您使用的是System.Drawing,则StringFormat可能不够通用.

这是一种更为通用的工具,可让您轻松更改方向并进行其他线性变换.您需要的是属性System.Drawing.Graphics.Transform,请参阅 http://msdn. microsoft.com/en-us/library/system.drawing.graphics.transform.aspx [
If you are using System.Drawing, StringFormat might be not universal enough for you.

This is one much more universal tool which will allow you to change orientation and do other linear transformations with ease. What you need is the property System.Drawing.Graphics.Transform, please see http://msdn.microsoft.com/en-us/library/system.drawing.graphics.transform.aspx[^].

You can assign different values to the property Trasform in the middle of rendering. For example, assign instance of transform, draw a string vertically, restore transform to the saved default value or change its orientation — draw another string horizontally or at the angle or draw something else.

You can apply any affine transform. For example, this method is the only way to render, say, a text written on a wall of a box depicted at the angle in some projection…

—SA


这篇关于使用C#从底部到顶部方向绘制文本.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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