可以用Graphics.DrawLine 方法

解决方案 »

  1.   

    新建一个自定义控件:定义画笔:
    private System.Drawing.Pen TopPen=new Pen(System.Drawing.SystemColors.ControlDark);
    private System.Drawing.Pen BottomPen=new Pen(System.Drawing.SystemColors.ControlLightLight);(由于线条是上暗下明,所以我定义了两个画笔,当然一个也可以完成,不过需要在运行时去改变它划线的颜色)
    重写OnPaint()
    protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
    {
        base.OnPaint(e);
                              //width-线的长度,可以取控件当前的长度,this.Width;
                               //暗线
    e.Graphics.DrawLine(this.TopPen,0,1,this.Width,1);
    //明线
                               e.Graphics.DrawLine(this.BottomPen,0,2,this.Width,2); }
    然后你把这个控件拖到你要有线的窗体中去放到划线的地方,运行,就有结果了!
      

  2.   

    新建一个自定义控件:定义画笔:
    private System.Drawing.Pen TopPen=new Pen(System.Drawing.SystemColors.ControlDark);
    private System.Drawing.Pen BottomPen=new Pen(System.Drawing.SystemColors.ControlLightLight);(由于线条是上暗下明,所以我定义了两个画笔,当然一个也可以完成,不过需要在运行时去改变它划线的颜色)
    重写OnPaint()
    protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
    {
        base.OnPaint(e);
                              //width-线的长度,可以取控件当前的长度,this.Width;
                               //暗线
    e.Graphics.DrawLine(this.TopPen,0,1,this.Width,1);
    //明线
                               e.Graphics.DrawLine(this.BottomPen,0,2,this.Width,2); }
    然后你把这个控件拖到你要有线的窗体中去放到划线的地方,运行,就有结果了!
      

  3.   

    就是DrawLine罗
    你看看GDI+方面的内容吧