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;namespace WindowsFormsApplication1 { public partial class Form2 : Form { Point startpoint = new Point(0, 0); Point endpoint; public Form2() { InitializeComponent(); this.DoubleBuffered = true; } private void Form2_MouseMove(object sender, MouseEventArgs e) { this.endpoint = new Point(e.X, e.Y); this.Invalidate(); } private void Form2_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawLine(Pens.Red, this.startpoint, this.endpoint); } } }
Point startpoint = new Point(0, 0); Point endpoint; public Form2() { InitializeComponent(); this.DoubleBuffered = true; } private void Form2_MouseMove(object sender, MouseEventArgs e) { this.endpoint = new Point(e.X, e.Y); this.Invalidate(); } //在窗体需要重绘的时候执行绘制直线方法 private void Form2_Paint(object sender, PaintEventArgs e) { e.Graphics.DrawLine(Pens.Red, this.startpoint, this.endpoint); //绘图.绘制直线 (红色画笔,起点坐标,终点坐标) }+1分全部都是3楼的~~~~~郁闷,来晚了,今天不玩了,每次都是来晚~~~~
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;namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
Point startpoint = new Point(0, 0);
Point endpoint;
public Form2()
{
InitializeComponent();
this.DoubleBuffered = true;
} private void Form2_MouseMove(object sender, MouseEventArgs e)
{
this.endpoint = new Point(e.X, e.Y);
this.Invalidate();
} private void Form2_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawLine(Pens.Red, this.startpoint, this.endpoint);
}
}
}
Point endpoint;
public Form2()
{
InitializeComponent();
this.DoubleBuffered = true;
} private void Form2_MouseMove(object sender, MouseEventArgs e)
{
this.endpoint = new Point(e.X, e.Y);
this.Invalidate();
} //在窗体需要重绘的时候执行绘制直线方法
private void Form2_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawLine(Pens.Red, this.startpoint, this.endpoint);
//绘图.绘制直线 (红色画笔,起点坐标,终点坐标)
}+1分全部都是3楼的~~~~~郁闷,来晚了,今天不玩了,每次都是来晚~~~~