Tuesday, February 3, 2009

Allow scrolling in a MultiLine TextBox when Enabled="False"

I came across this problem today. We have a MultiLine TextBox in which typing should be disabled but where the scrollbars should be enabled.

I tried setting the Enabled property to False. But this had the side effect of not being able to use the scrollbars anymore. So I set the Enabled property to True and set the ReadOnly property to True. This worked, but there was no more visual difference between an editable TextBox and a non-editable. The background of the text was White and the text Black, so I set the ForeColor property to Gray.

Anyways here is the code.



And this is the result.

No comments:

Post a Comment