读书人

c# txt下划线的有关问题

发布时间: 2012-07-08 17:43:44 作者: rapoo

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();            }        }    } 

读书人网 >C#

热点推荐