且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

禁用控制权变动TEXTCOLOR

更新时间:2023-12-03 19:42:58

编辑:我已经犯了同样的错误,因为科迪的意见,以便纠正我的答案

I had made the same mistake as Cody in the comments so corrected my answer.

这取决于它控制它。

例如,如果它是一个文本框也许你可以把它只读,而不是禁止。而对于其他一些控件,你也许可以做类似的事情,使他们会被禁用,而无需实际被禁用。

For example, if it's a TextBox maybe you could make it ReadOnly instead of disabled. And for some other controls you might be able to do similar things to make them appear disabled without actually being disabled.

不过,如果你想要做正确,你需要让他们重绘或重写OnPaint事件,并自己绘制的文本。

However, if you want to do it properly you need to make them Owner-draw or override the OnPaint event and draw the text yourself.