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# ,