本文實例講述了C#圖形區(qū)域剪切的實現(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 Form16 : Form  {    public Form16()    {      InitializeComponent();    }    private void Form16_Paint(object sender, PaintEventArgs e)    {      Graphics g = e.Graphics;      GraphicsPath path = new GraphicsPath();      path.AddEllipse(this.ClientRectangle);      Region regoin = new Region(path);      g.DrawPath(Pens.Red, path);      g.Clip = regoin;      Rectangle rect = this.ClientRectangle;      rect.Offset(10, 10);      rect.Width -= 20;      rect.Height -= 20;      g.FillRectangle(Brushes.Black, rect);      g.DrawString("zhuzhao", this.Font, Brushes.Blue, 100, 100);    }  }}希望本文所述對大家的C#程序設(shè)計有所幫助。
新聞熱點
疑難解答
圖片精選