<p>I need to display a variable-length message and allow the text to be selectable. I have made the TextBox ReadOnly which does not allow the text to be edited, but the input caret is still shown. </p>

<p>The blinking input caret is confusing. How do I hide it?</p>

[{'answer_id': 44146, 'author': 'Simon Gillbee', 'author_id': 756, 'author_profile': 'https://Stackoverflow.com/users/756', 'pm_score': 1, 'selected': False, 'text': "<p>If you disable the text box (set <code>Enable=false</code>), the text in it is still scrollable and selectable. If you don't like the visual presentation of a disabled text box (gray background usually) you can manually override the colors.</p>\n\n<p>Be warned, manually overriding colors is going to make your form/control look weird on systems that do not use the default color/theme settings. Don't assume that because your control is white that everyone's control is going to be white. That's why you should always use the system colors whenever possible (defined in the <code>System.Drawing.SystemColors</code> enumeration) such as <code>SystemColors.ControlLight</code>.</p>\n"}, {'answer_id': 44173, 'author': 'Rob Cooper', 'author_id': 832, 'author_profile': 'https://Stackoverflow.com/users/832', 'pm_score': -1, 'selected': False, 'text': "<p>AFAIK, this <strong>cannot</strong> be done. The TextBox control is a funny control because it actually has a <em>lot</em> of behaviour that can't be modified due to the way it taps into the operating system. This is why many of the cool custom TextBoxes are written from scratch.</p>\n\n<p>I am afraid you may not be able to do what you wish to do :(</p>\n"}, {'answer_id': 44174, 'author': 'Lars Truijens', 'author_id': 1242, 'author_profile': 'https://Stackoverflow.com/users/1242', 'pm_score': 5, 'selected': True, 'text': '<p>You can do through a win32 call</p>\n\n<pre><code>[DllImport("user32.dll")]\nstatic extern bool HideCaret(IntPtr hWnd);\npublic void HideCaret()\n{\n    HideCaret(someTextBox.Handle);\n}\n</code></pre>\n'}, {'answer_id': 2359382, 'author': 'Landon', 'author_id': 283951, 'author_profile': 'https://Stackoverflow.com/users/283951', 'pm_score': 3, 'selected': False, 'text': "<p>When using the win32 call don't forget to hide the cursor in the textbox's GotFocus event.</p>\n"}, {'answer_id': 16515169, 'author': 'Uwe Keim', 'author_id': 107625, 'author_profile': 'https://Stackoverflow.com/users/107625', 'pm_score': 2, 'selected': False, 'text': '<p>Just for completeness, I needed such a functionality for using with a <a href="http://documentation.devexpress.com/#windowsforms/clsDevExpressXtraEditorsTextEdittopic" rel="nofollow">DevExpress WinForms <code>TextEdit</code> control</a>.</p>\n\n<p>They already do provide a <code>ShowCaret</code> and a <code>HideCaret</code> method, unfortunately they are protected. Therefore I created a derived class that provides the functionality. Here is the full code:</p>\n\n<pre><code>public class MyTextEdit : TextEdit\n{\n    private bool _wantHideCaret;\n\n    public void DoHideCaret()\n    {\n        HideCaret();\n\n        _wantHideCaret = true;\n    }\n\n    public void DoShowCaret()\n    {\n        ShowCaret();\n\n        _wantHideCaret = false;\n    }\n\n    protected override void OnGotFocus(EventArgs e)\n    {\n        base.OnGotFocus(e);\n\n        if (_wantHideCaret)\n        {\n            HideCaret();\n        }\n    }\n}\n</code></pre>\n\n<p>To use the code, simply use the derived class instead of the original <code>TextEdit</code> class in your code and call <code>DoHideCaret()</code> anywhere, e.g. in the constructor of your form that contains the text edit control.</p>\n\n<p>Maybe this is helpful to someone in the future.</p>\n'}, {'answer_id': 66929561, 'author': 'Leonard Clark', 'author_id': 5130236, 'author_profile': 'https://Stackoverflow.com/users/5130236', 'pm_score': -1, 'selected': False, 'text': "<p>I know this is an old thread but it is a useful reference.</p>\n<p>I solved the problem with a much easier but very kludgie solution, which may depend on how much control you have over the user's access to the form.  I added a textbox (any focus-able control) which I gave prime tabIndex value and then positioned it off-form so that it was not visible.  This works fine on a dialog because the user can't resize.  If the form is resizeable, this may not work.</p>\n<p>As I said, a kludge - but a lot easier to set up.  (BTW I found the HideCaret approach didn't work - but I didn't pursue it hard.)</p>\n"}]
['https://Stackoverflow.com/questions/44131', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1042/']