使用Matrix设置字体

废话少说,看代码
  1.             e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
  2.             GraphicsPath gPath = new GraphicsPath();
  3.             //GraphicsPath gPath2 = new GraphicsPath();
  4.             gPath.AddString("我的字体", Font.FontFamily, 0, 20, new Point(100, 50), new StringFormat());
  5.             e.Graphics.FillPath(new SolidBrush(Color.Blue), gPath);
  6.             float scaleX = 1;
  7.             float scaleY = 2f;
  8.             RectangleF recF = gPath.GetBounds();
  9.             //放大相应的倍数,并回到原字符串的启示位置。
  10.             /*matrix放大了相应的x,y坐标。*/
  11.             Matrix matrix = new Matrix(scaleX, 0, 0, scaleY, recF.X - recF.X * scaleX, recF.Y - recF.Y * scaleY);
  12.             //matrix.Scale(2, 3, MatrixOrder.Append);
  13.             gPath.Transform(matrix);
  14.             
  15.             e.Graphics.FillPath(new SolidBrush(Color.Red), gPath);
  16.             ScaleExample(e);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值