提问:如何将CSharp中的TextBox将边框改变成底部一条线 提问:如何将CSharp中的TextBox将边框改变成底部一条线 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参考方法http://blog.csdn.net/yanchao1023/article/details/5458803 style= "border:0;border-bottom:1 solid black " 简单的做法:把textbox设置为无边框然后再在下面放一根线c#好像没有画线的控件了 重绘textbox public partial class posTexbox : System .Windows .Forms .TextBox { public posTexbox() { InitializeComponent(); this.Width = 100; this.BorderStyle = BorderStyle.None; } private Color _linecolor = Color.Red; /// <summary> /// 线条颜色 /// </summary> public Color LineColor { get { return this._linecolor; } set { this._linecolor = value; this.Invalidate(); } } protected override void OnPaint(PaintEventArgs e) { //this.BackColor = Color.DarkSlateBlue; base.OnPaint(e); } private const int WM_PAINT = 0xF; protected override void WndProc(ref Message m) { base.WndProc(ref m); if (m.Msg == WM_PAINT) { DrawLine(); } } private void DrawLine() { Graphics g = this.CreateGraphics(); using (Pen p = new Pen(this._linecolor)) { g.DrawLine(p, 0, this.Height - 1, this.Width, this.Height - 1); } } protected override void OnEnter(EventArgs e) { base.OnEnter(e); this.SelectAll(); this.BackColor = Color.White; this.ForeColor = Color.Black; } protected override void OnLeave(EventArgs e) { base.OnLeave(e); this.BackColor = Color.Black; this.ForeColor = Color.White; } } winform 需要连接压杆打印机打票据,各位大侠给点建议,顶者有分 串口收不到信息why 如何编程追加access表 简单问题,关于ispostback 一个用户控件的问题,希望得到解答 关于C#网络通信问题 请教一下,如何在vc6写的com组件中实例化C#写的组件? 弱弱为一个C#网络通信的概念问题 短消息采用PDU模式发送,为什么总有部分字节数据对方接收不到(最后几个字节丢失)? 如何生成一个DBF文件 checkedComboBoxEdit 多选数据要怎么写 ◆winform下如何判断datagridview中的新增、删除、修改状态◆
把textbox设置为无边框
然后再在下面放一根线
c#好像没有画线的控件了
public partial class posTexbox : System .Windows .Forms .TextBox
{
public posTexbox()
{
InitializeComponent();
this.Width = 100;
this.BorderStyle = BorderStyle.None;
}
private Color _linecolor = Color.Red;
/// <summary>
/// 线条颜色
/// </summary>
public Color LineColor
{
get
{
return this._linecolor;
}
set
{
this._linecolor = value;
this.Invalidate();
}
}
protected override void OnPaint(PaintEventArgs e)
{
//this.BackColor = Color.DarkSlateBlue;
base.OnPaint(e);
}
private const int WM_PAINT = 0xF;
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_PAINT)
{
DrawLine();
}
}
private void DrawLine()
{
Graphics g = this.CreateGraphics();
using (Pen p = new Pen(this._linecolor))
{
g.DrawLine(p, 0, this.Height - 1, this.Width, this.Height - 1);
}
} protected override void OnEnter(EventArgs e)
{
base.OnEnter(e);
this.SelectAll();
this.BackColor = Color.White;
this.ForeColor = Color.Black;
}
protected override void OnLeave(EventArgs e)
{
base.OnLeave(e);
this.BackColor = Color.Black;
this.ForeColor = Color.White;
}
}