张静茹作者
11年1个月前IP:山东
796078
4楼
引用 acmilan:
可能.NET的Text属性的实现有问题,建议尝试一下不改变Text属性,而是直接调用SetWindowText或者发送WM_SETTEXT设置文本。



TextBox继承自ConTrol
// System.Windows.Forms.TextBox
public override string Text
{
    get
    {
        return base.Text;
    }
    set
    {
        base.Text = value;
        this.selectionSet = false;
    }
}


ConTrol的
// System.Windows.Forms.Control
[Bindable(true), Localizable(true), DispId(-517), SRCategory("CatAppearance"), SRDescription("ControlTextDescr")]
public virtual string Text
{
    get
    {
        if (!this.CacheTextInternal)
        {
            return this.WindowText;
        }
        if (this.text != null)
        {
            return this.text;
        }
        return "";
    }
    set
    {
        if (value == null)
        {
            value = "";
        }
        if (value == this.Text)
        {
            return;
        }
        if (this.CacheTextInternal)
        {
            this.text = value;
        }
        this.WindowText = value;
        this.OnTextChanged(EventArgs.Empty);
        if (this.IsMnemonicsListenerAxSourced)
        {
            for (Control control = this; control != null; control = control.ParentInternal)
            {
                Control.ActiveXImpl activeXImpl = (Control.ActiveXImpl)control.Properties.GetObject(Control.PropActiveXImpl);
                if (activeXImpl != null)
                {
                    activeXImpl.UpdateAccelTable();
                    return;
                }
            }
        }
    }
}
评论
文号 / 796078

千古风流
名片专栏发私信
学术分 1
总主题 146 帖总回复 1873 楼拥有证书:进士 学者 机友 笔友
注册于 2010/12/30 03:32:26最后登录 2026/06/20 19:33:53
主体类型:个人
所属领域:无
认证方式:手机号
IP归属地:0

个人简介

暂未填写
笔记
{{note.content}}
{{n.user.username}}
{{fromNow(n.toc)}} {{n.status === noteStatus.disabled ? "已屏蔽" : ""}} {{n.status === noteStatus.unknown ? "正在审核" : ""}} {{n.status === noteStatus.deleted ? '已删除' : ''}}
  • 编辑
  • 删除
  • {{n.status === 'disabled' ? "解除屏蔽" : "屏蔽" }}
我也是有底线的