GDI+文字旋转
2009-11-09 14:53
260 查看
要使用GDI+,必须先创建Graphics对象,创建Graphics共有三种方法,第一种为
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g =e.Graphics;
第二种为:Graphics gh = this.CreateGraphics();也可以用Graphics gh = Button1.CreateGraphics;
第三种为:
Bitmap myBitmap=new Bitmap("C:/myPic.bmp");
Graphics g= Graphics.FromImage(myBitmap);
//使用Graphics
g.SmoothingMode=SmoothingMode.Default;
string tempstr = "章松山";
SizeF f = g.MeasureString(tempstr, new Font("宋体", 9));
g.TranslateTransform(f.Height,0);//偏移量
g.RotateTransform(45);
Brush myBrush = Brushes.Blue;
g.DrawString(tempstr, this.Font, myBrush, 0, 0);
g.DrawRectangle(new Pen(Color.Red), 0, 0, f.Width, f.Height);
g.ResetTransform();
//以上绘制了一个带方框的文本。
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g =e.Graphics;
第二种为:Graphics gh = this.CreateGraphics();也可以用Graphics gh = Button1.CreateGraphics;
第三种为:
Bitmap myBitmap=new Bitmap("C:/myPic.bmp");
Graphics g= Graphics.FromImage(myBitmap);
//使用Graphics
g.SmoothingMode=SmoothingMode.Default;
string tempstr = "章松山";
SizeF f = g.MeasureString(tempstr, new Font("宋体", 9));
g.TranslateTransform(f.Height,0);//偏移量
g.RotateTransform(45);
Brush myBrush = Brushes.Blue;
g.DrawString(tempstr, this.Font, myBrush, 0, 0);
g.DrawRectangle(new Pen(Color.Red), 0, 0, f.Width, f.Height);
g.ResetTransform();
//以上绘制了一个带方框的文本。
相关文章推荐
- C# 使用 GDI+ 实现添加中心旋转(任意角度)的文字
- GDI+ 文字旋转后 位置变化.
- C#利用GDI+绘制旋转文字等效果实例
- GDI+文字旋转
- GDI+简单现实文字旋转
- GDI+简单现实文字旋转
- C#利用GDI+绘制旋转文字等效果
- C#中基于GDI+(Graphics)图像处理系列之文字或者图片水印(透明、任意角度旋转)
- C# 使用 GDI+ 实现添加中心旋转(任意角度)的文字
- C#利用GDI+绘制旋转文字,矩形内可以根据布局方式排列文本
- GDI+简单现实文字旋转
- JS旋转的彩色文字轮转特效
- C语言版GDI+应用例子 -- 文字
- javascript文字旋转效果
- 再学 GDI+[85]: TGPImage(5) - RotateFlip - 旋转与镜像
- GDI+基础编程 输出文字
- Flex Gumbo中如何通过textRotation样式,设置TextGraphic文字旋转方向
- HTML5绘图之文字旋转
- 使用CSS旋转文字
- java图片验证码包括文字和图片的旋转