本人用的是.net framework 1.1版本。原先的MFC有CFont可以实现文字的倾斜绘制,就是说用一定角度写文字,但是这几天用GDI+我怎么找也找不到对应的函数,是不是GDI+不支持斜绘文字啊??
高手们,给个解决方案吧~~~~~
高手们,给个解决方案吧~~~~~
解决方案 »
- 一个新手问题:语音卡和来电显示盒有什么不同?
- [简单但是我不会]如何知道一个Dataset里面有没有数据?
- 请教一条SQL查询语句
- 请教几个c#调用c++dll的问题
- 为什么DataGrid在更新时更新不了,显示编辑失败
- listview控件 如何让显示的图片在上面,文字在下面
- word对象模型如何获取选中的表格的Id
- 本地机装Win2000,虚拟机上新装XP系统。大家帮忙想想咋整点新花样玩玩?
- Web 窗体用户控件:注册了用户控件后,???怎么注册这个用户控件呢?
- C# 标记RichTextBox里的关键数据
- 如何旋转图像中的文字?
- C#.NET2005调用OCX问题,2003没有这样的问题,高手进来帮忙
String s,
Font font, // FontStyle.Italic 就是斜体字
Brush brush,
PointF point)
g.RotateTransform(30f);
g.DrawString("倾斜ABCabc", this.Font, SystemBrushes.WindowText, 10f, 10f);
g.ResetTransform();
g.Dispose();
g = null;试试看。
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing.Drawing2D;
using System.Drawing.Text;namespace RotateText
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Name = "Form1";
this.Text = "Form1";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
} private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
// 声明并初始化Graphics对象g
Graphics g = e.Graphics;
g.SmoothingMode = SmoothingMode.AntiAlias;
string tempStr = "Hello,C#";//取得要显示的文字
for(int i=0;i<361;i+=10){
//将指定的平移添加到g的变换矩阵前
g.TranslateTransform(150,150);
// 将指定的旋转用于g的变换矩阵
g.RotateTransform(i);
// 定义自己的画刷
Brush myBrush = Brushes.Blue;
//显示旋转文字
g.DrawString(tempStr,this.Font,myBrush,60,0);
// 将g的全局变换矩阵重置为单位矩阵
g.ResetTransform();
}
}
}
}
g.DrawString("车载合格证", new Font("宋体", 20, FontStyle.Regular), Brushes.Black, 100, 300);
g.ResetTransform();我这样怎么不旋转呢?