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 WindowsFormsApplication20 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics(); g.DrawLine(new Pen(Color.Red, 2), new Point(10, 10), new Point(100, 100)); g.Dispose(); } } }
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace WindowsFormsApplication20
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics();
g.DrawLine(new Pen(Color.Red, 2), new Point(10, 10), new Point(100, 100));
g.Dispose();
}
}
}
你用g.DrawLine(new Pen(Color.Red, 2), new Point(10, 10), new Point(100, 100)); g.DrawLine(new Pen(Color.Red, 2), 10, 10,100, 100)); 也可以吧 你那样的话 对程序来说效率会更快么? 我是菜鸟。最近刚刚开始研究DGI+绘图和图像处理