C# GDI+画直线的。我现在弄的代码不能变为直线,只能是曲线,请问可以帮我看一下吗,谢谢了
privatevoidpictureBox1_MouseDown(objectsender,MouseEventArgse){if(e.Button==MouseButt...
private void pictureBox1_MouseDown
(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)//是否是鼠标左键按下
{
point.X = e.X;
point.Y = e.Y; //画线段开始点
mark = true;
} //鼠标左键按下标识
}
private void pictureBox1_MouseUp
(object sender, MouseEventArgs e)
{
{
Pen pen1=new Pen(Color.Black);
EndPoint.X=e.X;
EndPoint.Y=e.Y;
Rectangle r1=MakeRectangle(StartPoint,EndPoint);
bitG.DrawLine(pen1,point.X, point.Y, e.X, e.Y);
mark=false;
pictureBox1.Image=bits;
}
}
private void pictureBox1_MouseMove
(object sender, MouseEventArgs e)
{
if (mark)
{
Graphics g = pictureBox1.CreateGraphics();
Pen pen1 = new Pen(Color.Black);
//图形画在PictureBox表面
g.DrawLine(pen1, point.X, point.Y, e.X, e.Y);
//图形画在位图对象bits中
bitG.DrawLine(pen1, point.X, point.Y, e.X, e.Y);
point.X = e.X;
point.Y = e.Y;
}//下次绘制画线段开始点
} 展开
(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)//是否是鼠标左键按下
{
point.X = e.X;
point.Y = e.Y; //画线段开始点
mark = true;
} //鼠标左键按下标识
}
private void pictureBox1_MouseUp
(object sender, MouseEventArgs e)
{
{
Pen pen1=new Pen(Color.Black);
EndPoint.X=e.X;
EndPoint.Y=e.Y;
Rectangle r1=MakeRectangle(StartPoint,EndPoint);
bitG.DrawLine(pen1,point.X, point.Y, e.X, e.Y);
mark=false;
pictureBox1.Image=bits;
}
}
private void pictureBox1_MouseMove
(object sender, MouseEventArgs e)
{
if (mark)
{
Graphics g = pictureBox1.CreateGraphics();
Pen pen1 = new Pen(Color.Black);
//图形画在PictureBox表面
g.DrawLine(pen1, point.X, point.Y, e.X, e.Y);
//图形画在位图对象bits中
bitG.DrawLine(pen1, point.X, point.Y, e.X, e.Y);
point.X = e.X;
point.Y = e.Y;
}//下次绘制画线段开始点
} 展开
2016-06-14
展开全部
代码呢?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2016-06-14
展开全部
我那方面需求很大,你能满足我么
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询