这是我照着书敲的,我是刚学,这代码倒是没出现语法错误,但是编译不了。请高手指导一下改怎么办,谢谢!!
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 WindowsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
protected override void OnPaint ( PaintEventArgs e)
{
Rectangle r1=new Rectangle(10,10,50,50);
Rectangle r2=new Rectangle(40,40,50,50);
Region r=new Region(r1);
r.Union(r2);
GraphicsPath path=new GraphicsPath(new Point[]{
new Point(45,45),
new Point(145,55),
new Point(200,150),
new Point(45,45)},
new byte[]{
(byte)PathPointType.Start,
(byte)PathPointType.Bezier,
(byte)PathPointType.Bezier,
(byte)PathPointType.Bezier,
(byte)PathPointType.Line});
r.Union(path);
e.Graphics.FillRegion(Brushes.Blue,r);
}
}
}
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 WindowsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
protected override void OnPaint ( PaintEventArgs e)
{
Rectangle r1=new Rectangle(10,10,50,50);
Rectangle r2=new Rectangle(40,40,50,50);
Region r=new Region(r1);
r.Union(r2);
GraphicsPath path=new GraphicsPath(new Point[]{
new Point(45,45),
new Point(145,55),
new Point(200,150),
new Point(45,45)},
new byte[]{
(byte)PathPointType.Start,
(byte)PathPointType.Bezier,
(byte)PathPointType.Bezier,
(byte)PathPointType.Bezier,
(byte)PathPointType.Line});
r.Union(path);
e.Graphics.FillRegion(Brushes.Blue,r);
}
}
}
new Point(45,45),
new Point(145,55),
new Point(200,150),
new Point(45,45)},
new byte[]{
(byte)PathPointType.Start,
(byte)PathPointType.Bezier,
(byte)PathPointType.Bezier,
(byte)PathPointType.Bezier,
(byte)PathPointType.Line}); 一个4条
一个5条好伐~~~