重绘吧
Winform你想要这样的效果成本就大了。你支付不起的。
为什么这么说啊。。。
在字体里面设置下滑线,然后Text属性打空格就实现了啊
自定义usercontol,下面放个1px高的label,上面放个textbox
设置字体样式
自己写了个label继承于
public partial class UnderLineLabel :System.Windows.Forms.Label { private Color _lineColor; private float _lineThick; private float[] _DashPattern; private DashStyle _DashStyle; public UnderLineLabel() { _lineColor = base.ForeColor; _lineThick = 1f; _DashStyle = DashStyle.Solid; } [Browsable(true)] public Color LineColor { get { return _lineColor; } set { _lineColor = value; Invalidate(); } } [Browsable(true)] public float LineThick { get { return _lineThick; } set { _lineThick = value; Invalidate(); } } [Browsable(true)] public float LinePenMode { get { return _lineThick; } set { _lineThick = value; Invalidate(); } } [Browsable(true)] public float[] LineDashPattern { get { return _DashPattern; } set { _DashPattern = value; Invalidate(); } } [Browsable(true)] public DashStyle LineDashStyle { get { return _DashStyle; } set { _DashStyle = value; Invalidate(); } } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); Pen p = new Pen(LineColor, LineThick); p.DashStyle = LineDashStyle; if ((p.DashStyle == DashStyle.DashDot) || (p.DashStyle == DashStyle.DashDotDot)) p.DashPattern = LineDashPattern; e.Graphics.DrawLine(p,2,this.Height-1, this.Width,this.Height-1); } }
label