110,533
社区成员
发帖
与我相关
我的任务
分享
public Form2()
{
InitializeComponent();
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form2Paint);
}
private void Form2Paint(object sender, PaintEventArgs e)
{
Graphics g = this.panel1.CreateGraphics();
Pen pen = new Pen(Color.Red,2);
Point oldPoint = new Point();
oldPoint.X = oldbtn.Location.X + oldbtn.Width;
oldPoint.Y = oldbtn.Location.Y + oldbtn.Height / 2;
Point newPoint = new Point();
newPoint.X = newbtn.Location.X;
newPoint.Y = newbtn.Location.Y + oldbtn.Height / 2;
g.DrawLine(pen, newPoint, oldPoint);
}