C#實(shí)現(xiàn)圖形路徑變換的方法
本文實(shí)例講述了C#實(shí)現(xiàn)圖形路徑變換的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
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#程序設(shè)計(jì)有所幫助。
相關(guān)文章
C#將DataGridView中的數(shù)據(jù)保存到CSV和Excel中
這篇文章介紹了C#將DataGridView中的數(shù)據(jù)保存到CSV和Excel中的方法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-04-04C#使用DateTime.Now靜態(tài)屬性動態(tài)獲得系統(tǒng)當(dāng)前日期和時(shí)間
本文主要介紹了C#使用DateTime.Now靜態(tài)屬性動態(tài)獲得系統(tǒng)當(dāng)前日期和時(shí)間,DateTime結(jié)構(gòu)的Now靜態(tài)屬性只是得到一個(gè)系統(tǒng)時(shí)間對象,該時(shí)間對象不會隨著系統(tǒng)時(shí)間的變化而變化,如果要?jiǎng)討B(tài)顯示系統(tǒng)時(shí)間,可以使用計(jì)時(shí)器間隔地獲取系統(tǒng)時(shí)間對象并顯示,感興趣的可以了解一下2024-01-01C#實(shí)現(xiàn)的Socket服務(wù)器端、客戶端代碼分享
這篇文章主要介紹了C#實(shí)現(xiàn)的Socket服務(wù)器端、客戶端代碼分享,2個(gè)非常簡單的入門例子,需要的朋友可以參考下2014-08-08C#導(dǎo)航器Xpath與XPathNavigator類
這篇文章介紹了C#導(dǎo)航器Xpath與XPathNavigator類,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-06-06C#實(shí)現(xiàn)SQL批量插入數(shù)據(jù)到表的方法
這篇文章主要介紹了C#實(shí)現(xiàn)SQL批量插入數(shù)據(jù)到表的方法,涉及C#批量操作SQL的相關(guān)技巧,需要的朋友可以參考下2016-04-04C#使用GZipStream解壓縮數(shù)據(jù)文件的方法
這篇文章主要介紹了C#使用GZipStream解壓縮數(shù)據(jù)文件的方法,實(shí)例分析了C#中GZipStream方法的原理與使用技巧,需要的朋友可以參考下2015-04-04