سؤال

I have Edit Controls and Rich Edit controls in my application that are read-only. But on top of that, I want to make it so I can't select the text or even do anything with it, only display. I did not make it static because when I first made my application I didn't know any better. The ways I thought about solving it would be to disable it. The problem is that if I disable them, they get grey. Is there any good option other than replacing them? Also, for some reason, the "no hide selection" is not working at all. When I select something and then kill the focus, it stays selected...

Info: IDE: Visual Studio 2010 - Ultimate / Border: Dialog Frame

Thanks for your attention

هل كانت مفيدة؟

المحلول

For Edit control: It is not directly possible to disable the edit control and not greying it out. Here is an option: http://www.codeguru.com/forum/archive/index.php/t-210552.html

See the code reply from Simon666. You need to disable the edit control and override OnCtlColor() of your dialog and then paint the edit control with white in OnCtlColor.

OnCtlColor() function is called whenever the dialog starts painting it's controls. So, you override it, allow it to paint in normal fashion (first line) and then you paint the required control in your way.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top