日期:2014-05-18  浏览次数:20971 次

c#运行缺少Point命名空间怎么办?恳请高手帮忙
Form1.cs://这是教材上的一个例子
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace 多窗体界面设置
{
   
   
  public partial class Form1 : Form
  {
  private Point p1, p2;
  private LineCap StartCap;
  private LineCap EndCap;
  public Form1()
  {
  InitializeComponent();
  }

   

  private void button1_Click(object sender, EventArgs e)
  {
  Form2 f=new Form2();
  f.ShowDialog(this);
  this.StartCap=f.StartCap;
  this.EndCap=f.EndCap;
  this.p1=f.StartPoint;
  this.p2=f.EndPoint;
  this.label1.Refresh();
  }
  private void label1_Paint(object sender,System .Windows .Forms.PaintEventArgs e)
  {
  Graphics g=e.Graphics;
  Pen pen=new Pen(Color.Red,10.5f);
  pen.StartCap=StartCap;
  pen.EndCap=EndCap;
  g.DrawLine(pen,p1,p2);
  }
  }
}
Form2.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;



namespace 多窗体界面设置
{
  public partial class Form2 : Form
  {
  public LineCap StartCap;
  public LineCap EndCap;
  private Point p1;
  private Point p2;

  public Form2()
  {
  InitializeComponent();
  }
  public Point StartPoint
  {
  get
  {
  return p1;
  }
  }
  public Point EndPoint
  {
  get
  {
  return p2;

  }
  }
  private void Form2_Load(object sender, System.EventArgs e)
  {
  p1 = new Point(0, 0);
  p2 = new Point(0, 0);
  StartCap = LineCap.Flat;
  EndCap = LineCap.Flat;
  }
  private void button2_Click(object sender, EventArgs e)
  {

  }

  private void groupBox1_Enter(object sender, EventArgs e)
  {

  }

  private void button1_Click(object sender, EventArgs e)
  {
  if (LineStartX.Text.Equals(""))
  p1.X = 0;
  else
  p1.X = Int32.Parse(LineStartX.Text);
  if (LineStart.Y.Text.Equuals(""))
  p1.Y = 0;
  else
  p1.Y = Int32.Parse(LineStartY.Text);
  if (LineEndX.Text.Equals(""))
  p2.X = 0;
  else
  p2.X = Int32.Parse(LineEndX.Text);
  if (LineEndY.Text.Equal(""))
  p2.Y = 0;
  else