文件名称:如何创建不规则窗体,可以实现
文件大小:821B
文件格式:TXT
更新时间:2013-01-27 22:34:09
不规则
这需要用到多态具体代码如下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 窗体重写{ public partial class MainForm : Form { public MainForm() { InitializeComponent(); } protected override void OnPaint(PaintEventArgs e) { //重写父类窗体的方法 Point[] points = new Point[] { new Point(2, 1), new Point(55, 25), new Point(110, 200), new Point(99,200), new Point(77, 117), new Point(22,123)}; GraphicsPath path = new GraphicsPath(); //GrapjicsPath是图形路径 path.AddCurve(points); //增加曲线的点 this.Region = new Region(path); //Region本窗体的区域 }