打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
如何改变textBox形状
前面看到一个高手写的:
namespace UnderLineBox
{
    public class UnderLineBox : 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);//这里写你要绘制的形状。
                        }
                    }
                }
            }
        }
    }

}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
V8.9 CheckBox 控件
Asp.net主题(theme)和皮肤(skin)的使用
VB.NET Label控件实现功能介绍
C# TextBox横线样式及占位提示
C# at命令发送&&接收短信测试程序
永久储存
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服