public class Xtxt3 : TextBox
    {
        private bool m_underLine;

        public bool UnderLine
        {
            get { return m_underLine; }
            set
            {
                if (this.m_underLine != value)
                {
                    if (value)
                    {
                        this.BorderStyle = BorderStyle.None;
                    }
                    m_underLine = value;
                }
            }
        }
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);
            if (m.Msg == 0xf || m.Msg == 0x14 || m.Msg == 0x85)
            {
                if (this.BorderStyle == BorderStyle.None)
                {
                    if (m_underLine)
                    {
                        using (Graphics g = Graphics.FromHwnd(this.Handle))
                        {
                            g.DrawLine(SystemPens.ControlText, 0, this.Height - 1, this.Width - 1, this.Height - 1);
                        }
                    }
                }
            }
        }
    } 

  

相关文章:

  • 2022-12-23
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-15
  • 2022-12-23
  • 2022-03-06
  • 2022-12-23
  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
相关资源
相似解决方案