C#实现图形路径变换的方法
更新时间:2015年06月12日 12:29:10 作者:zhuzhao
这篇文章主要介绍了C#实现图形路径变换的方法,涉及C#针对图形路径的相关操作技巧,需要的朋友可以参考下
本文实例讲述了C#实现图形路径变换的方法。分享给大家供大家参考。具体实现方法如下:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; namespace advanced_drawing { public partial class Form10 : Form { public Form10() { InitializeComponent(); } GraphicsPath CreateLabeledRectPath(string label) { GraphicsPath path = new GraphicsPath(); Rectangle rect = new Rectangle(0, 0, 200, 200); FontFamily fontFamily=new FontFamily("Arial"); path.AddString(label, fontFamily, 20, 20f, new Point(0, 0), new StringFormat()); return path; } private void Form10_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; GraphicsPath path = CreateLabeledRectPath("zhuzhao"); g.DrawPath(Pens.Red, path); Matrix matrix = new Matrix(); matrix.Translate(150, 150); path.Transform(matrix); g.DrawPath(Pens.Black, path); } } }
希望本文所述对大家的C#程序设计有所帮助。
相关文章
C#将DataGridView中的数据保存到CSV和Excel中
这篇文章介绍了C#将DataGridView中的数据保存到CSV和Excel中的方法,文中通过示例代码介绍的非常详细。对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下2022-04-04C#使用DateTime.Now静态属性动态获得系统当前日期和时间
本文主要介绍了C#使用DateTime.Now静态属性动态获得系统当前日期和时间,DateTime结构的Now静态属性只是得到一个系统时间对象,该时间对象不会随着系统时间的变化而变化,如果要动态显示系统时间,可以使用计时器间隔地获取系统时间对象并显示,感兴趣的可以了解一下2024-01-01
最新评论