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

C#做的画板 问题请教!!
想用C#做个画板的小程序 不知道为什么不能画出画来 是我的鼠标事件没写对么 没有报错 但是鼠标不能画画
下面是form.cs 请各位帮忙看看 感激不尽


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;


namespace WindowsFormsApplication2
{
  public partial class Form1 : Form
  {
  private Shape current;
  private bool isDown;
  private Bitmap bmp, bmp1;
  private List <Shape >shapes=new List<Shape> ();
  private ShapeType type = ShapeType.Line;
  private bool isTrail;
  private FileInfo currentFile;
  private static string openFileName = "";
  private static int lineWidth = 1;

  public Form1()
  {
  InitializeComponent();
  bmp = new Bitmap(pictureBox1 .Width ,pictureBox1 .Height );
  bmp1 = new Bitmap(pictureBox1 .Width ,pictureBox1 .Height );
  current = new MyLine();
  this.button12.BackColor = Color.Black;
  }

  private void Form1_Paint(object sender, PaintEventArgs e)
  {
  Graphics grfx = e.Graphics;
  grfx.DrawImage(bmp ,0,0);
  }










  private void button1_Click(object sender, EventArgs e)
  {
  isTrail = true;
  type = ShapeType.Line;
  }

  private void button2_Click(object sender, EventArgs e)
  {
  isTrail = false ;
  type = ShapeType.Line;

  }

  private void button3_Click(object sender, EventArgs e)
  {
  isTrail = false;
  type = ShapeType.Rect ;
  }

  private void button5_Click(object sender, EventArgs e)
  {
  isTrail = false;
  type = ShapeType.Ellipse ;
  }

  private void button4_Click(object sender, EventArgs e)
  {
  isTrail = false;
  type = ShapeType.FilledRect ;
  }

  private void button6_Click(object sender, EventArgs e)
  {
  isTrail = false;
  type = ShapeType.FilledEllipse ;
  }

  private void button7_Click(object sender, EventArgs e)
  {
  isTrail = false;
  type = ShapeType.CircleRect;
  }

  private void button13_Click(object sender, EventArgs e)
  {
  this.button12.BackColor = this.button13.BackColor;
  }

  private void button14_Click(object sender, EventArgs e)
  {
  this.button12.BackColor = this.button14.BackColor;
  }

  private void button15_Click(object sender, EventArgs e)
  {
  this.button12.BackColor = this.button15.BackColor;
  }

  private void button16_Click(object sender, EventArgs e)
  {
  this.button12.BackColor = this.button16.BackColor;
  }
<