GDI+实现windows画板的功能
想做一个用GDI实现像windows画板一样的功能,但是不明白怎么样才能实现画笔拖动的时候能在画布上留下线,求指教啊。小弟新新手,求详细。。感激不尽。
//比如在Panel1上绘图
Point pStart;
Point pTemp;
Point pEnd;
int intFlag = 0;
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
pStart = new Point(e.X, e.Y);
intFlag = 1;
a += 1;
b += 1;
}
private void panel1_MouseUp(object sender, MouseEventArgs e)
{
intFlag = 0;
}
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if (intFlag == 1)
{
Line l = new Line(pTemp, pEnd, Color.Black,1);
l.draw(this.panel1);
}
pTemp = pEnd;
}
[ 本帖最后由 xydddaxia 于 2012-4-5 17:21 编辑 ]