禁用时文本框边框问题 [英] Textbox border problem when it is disable

查看:92
本文介绍了禁用时文本框边框问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Windows应用程序....我有一个表单有两个textbox..textbox边框样式设置为Fixed3d ....当我禁用文本框它改变边框样式...它看起来非常糟糕。 ..pls帮助我

I have windows application ....i have one form who have two textbox..textbox border style is set to Fixed3d....when i disable the textbox it chang the border style...it look very bad...pls help me

推荐答案

如果窗体形成那么它是默认行为

你可以使textbox readonly = true 并设置它的 BackgroundColor =灰色

和启用文本框 readonly = false 并设置它的 BackgroundColor = white

快乐编码!

:)
If windows form then it is default behaviour
you can make textbox readonly = true and set it's BackgroundColor = grey.
and for enable textbox readonly = false and set it's BackgroundColor = white.
Happy Coding!
:)


HI


无论何时何地禁用带有border3d边框的文本框,您可以将其更改为 FixedSingle



HI
whenever you are disabling a textbox with border fixed3d you can change it to FixedSingle or None

textBox1.Enabled = false;
           textBox1.BorderStyle = BorderStyle.FixedSingle;







textBox1.Enabled = true;
          textBox1.BorderStyle = BorderStyle.Fixed3D;


试试这个



try this

textBox1.Enabled = true;
textBox1.BackColor = Color.White;











or

textBox1.ReadOnly = true;
textBox1.BackColor = Color.White;


这篇关于禁用时文本框边框问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆