关于WINFORM的一个问题! 可以用Graphics.DrawLine 方法 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 新建一个自定义控件:定义画笔: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); }然后你把这个控件拖到你要有线的窗体中去放到划线的地方,运行,就有结果了! 新建一个自定义控件:定义画笔: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); }然后你把这个控件拖到你要有线的窗体中去放到划线的地方,运行,就有结果了! 就是DrawLine罗你看看GDI+方面的内容吧 泛型、隐式转换 求助 C#控制系统音量 如何在子窗口中显示图画内容 关于多个WCF 服务 想写一个服务,会的帮帮忙 .NET里面是否还有通用的串口属性设置窗口了? 能否借用.net2003的编辑环境,但编译调试的时候却调用其它的编译器? 如何使用FileUploaderAJAX上传大文件 为了通过单击按钮弹出窗体二,在button的click事件里添加2句,结果出错,为什么? 请帮忙分析一下,这段C#代码? 看看哪里错了 C#中可以使用VC6编写的DLL吗?
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); }
然后你把这个控件拖到你要有线的窗体中去放到划线的地方,运行,就有结果了!
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); }
然后你把这个控件拖到你要有线的窗体中去放到划线的地方,运行,就有结果了!
你看看GDI+方面的内容吧