C#應用Region對圖形區域結構和填充的辦法。本站提示廣大學習愛好者:(C#應用Region對圖形區域結構和填充的辦法)文章只能為提供參考,不一定能成為您想要的結果。以下是C#應用Region對圖形區域結構和填充的辦法正文
本文實例講述了C#應用Region對圖形區域結構和填充的辦法。分享給年夜家供年夜家參考。詳細以下:
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 Form15 : Form { public Form15() { InitializeComponent(); } private void Form15_Paint(object sender, PaintEventArgs e) { GraphicsPath myPath = new GraphicsPath(); string stringText = "zhuzhao"; FontFamily family = new FontFamily("Arial"); int fontStyle = (int)FontStyle.Italic; int emSize = 26; Point origin = new Point(20, 20); StringFormat format = StringFormat.GenericDefault; myPath.AddString(stringText,family,fontStyle,emSize,origin,format); Region region = new Region(myPath); e.Graphics.FillRegion(Brushes.Red, region); } } }
願望本文所述對年夜家的C#法式設計有所贊助。