例如Graphics g = this.CreateGraphics();
Point[] points ={ new Point(0, 0), new Point(300, 150), new Point(200, 200), new Point(400, 400) };
g.DrawLines(new Pen(Color.Blue), points);如果其中不确定画哪个点? 如何动态的选择呢?
Point[] points ={ new Point(0, 0), new Point(300, 150), new Point(200, 200), new Point(400, 400) };
g.DrawLines(new Pen(Color.Blue), points);如果其中不确定画哪个点? 如何动态的选择呢?
Point p2 = new Point(300, 150);
Point p3 = new Point(200, 200);
Point p4 = new Point(400, 200);
bool b = true;
if (b == true)
{
p2 = Point.Empty;
p3 = Point.Empty;
}
Point[] points ={ p1, p2, p3, p4 };
g.DrawLines(new Pen(Color.Blue), points);我暂时是用Point.Empty来实现,但是Point.Empty会把点画到(0,0)处,而我需要的是如果我不需要哪点,哪点就不显示出来?哪位还有更好的解决办法??
求解中
Point p2,cp2 = new Point(300, 150);
Point p3,cp3 = new Point(200, 200);
Point p4,cp4 = new Point(400, 200);
bool b = true;
if (b == true)
{
p2 = cp1;
p3 = cp1;
}
Point[] points = { p1, p2, p3, p4 };
g.DrawLines(new Pen(Color.Blue), points);
Point p1,cp1 = new Point(50, 200);
p1这个点就必须画了
按照我的思路,P1应该也是可选的
谢谢回复,还有其他的方法吗??
你就把 p1 = cp3,p2 = cp3就可以了p3 = cp3,p4 = cp4就可以了
point点和string型好像没办法转换啊。。
或者把point转换成string之后,就没法搞回来了啊
继续求高手解答?
能不能说的详细一点呀?
public void OnMouseUp(object sender, MouseEventArgs e)
{
m_lstPt.Add(new Point(e.X, e.Y));
}
public void OnPaint(object sender, PaintEventArgs e)
{
if (m_lstPt.Length <= 1) return; e.Graphics.DrawLines(new Pen(Color.Red), m_lstPt);
}