The control needs to be able to paint text on several lines, respond to clicks on URLs or @user tags, etc, which need to have a different color in order to stand out.
The first obvious choice was a richedit control, but I ran into many issues with this. First off, I would like the text to be nonselectable and input to be disabled. The latter is easy, but the only way I found to disallow selecting text is to disable the control. In that case I can't figure out how to change the background color from the default gray to white. In addition, all the clickable link functionality I get for free from richedit stops working when the control is disabled.
What would you say are my options? I'm very wary of trying to use TextOut to make my own control. That might m开发者_JS百科ake me want to cry.
EDIT: Until now I didn't consider allowing the user to select text as an option, so the read only mode didn't seem useful. I just had it planned in my head that way. I definitely want there to not be a blinking caret, so I poked around and found that I can call HideCaret on WM_SETFOCUS of the richedit (by subclassing it) and returning 0. That got rid of the caret for good. Ironically, that also got rid of the ability to select anything with the mouse, which is almost exactly the behavior I was hoping for in the first place. I don't know if I'm entirely opposed to disallowing selection though. I'll get back to that. Now all that's left is to figure out if I can override the behavior of the cursor's image changing when hovering over text.
You could use the Webbrowser control and just build the HTML that displays what you want.
I'd hate the option with the control disabled, why not let me have access to select a part of the text to copy.
Anyway, you can set the colour to near white FEFEFE
and it should work, just not pure white.
Doesn't the RichEdit control have a 'readonly' mode, will stop input but let select the text and click on links.
精彩评论