日期:2014-05-18  浏览次数:20953 次

c# txt下划线的问题
有个像txt的类似的东西,有一条下划线,点击还能跳出其他的窗体,我想知道怎么去设置下划线的啊,不要说用lab画一条下面啊。是不是设置txt的边框只显示底部的就可以了啊。怎么实现、
谢谢大侠们,
有代码就好了

------解决方案--------------------
C# code

    class MyTextBox:TextBox
    {

        protected override void WndProc(ref System.Windows.Forms.Message m)
        {
            base.WndProc(ref m);
            const int WM_PAINT = 0xF;
            if (m.Msg == WM_PAINT)
            {
                Graphics g = Graphics.FromHwnd(this.Handle);
                g.DrawLine(new Pen(Brushes.Black), this.ClientRectangle.Left, this.ClientRectangle.Bottom - 2, this.ClientRectangle.Right, this.ClientRectangle.Bottom - 2);
                g.Dispose();
            }
        }
    }