你是怎么写的?
这样就可以了:
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g =e.Graphics;
g.DrawLine(Pens.Black,new Point(1,1),new Point(100,100));
g.Dispose();
}

解决方案 »

  1.   

    [C#] 
    public void DrawLineFloat(PaintEventArgs e)
    {
    // Create pen.
    Pen blackPen = new Pen(Color.Black, 3);
    // Create coordinates of points that define line.
    float x1 = 100.0F;
    float y1 = 100.0F;
    float x2 = 500.0F;
    float y2 = 100.0F;
    // Draw line to screen.
    e.Graphics.DrawLine(blackPen, x1, y1, x2, y2);
    }
      

  2.   

    重载OnPaint事件
    定义画笔 画 没问题
    最后别忘了调用 base.OnPaint(e);
      

  3.   

    private void InitializeComponent()
    {
    // 
    // Form1
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(292, 273);
    this.Name = "Form1";
    this.Text = "Form1";
    this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);//添加此行}
      

  4.   

    qiuji(忆秋季)厉害,^_^,问题解决了