跟着鼠标轨迹画线,问题多多
我能在Form上画图了,但是画在其他地方就不行了
还有就是画出来的图,怎么即时保存在窗体上,一但窗体状态发生变化,如最小化,画的东西就全部没得了,下面是我的代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
bool isdrawing = false;
Point endPoint;
private void Form1_Load(object sender, EventArgs e)
{
this.Cursor = new Cursor(@ "pen_m.cur ");
}
//在Form上画,画得起
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if ((isdrawing = !isdrawing) == true)
{
startPoint = new Point(e.X,e.Y);
endPoint = new Point(e.X,e.Y);
}
}
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if(isdrawing)
{