Is there any way to disable cursor in textbox without setting property Enable to false? I was trying to use ReadOnly property but despite the fact that I can't write in textbox, the cursor appears if I click the textbox. So is there any way to get rid of this cursor permamently?
situated at the top right. Select Settings from the drop-down menu that appear. Scroll to the end of the page, and click to expand Advanced settings. Scroll to the Accessibility section and disable the toggle next to 'Navigate pages with a text cursor' to turn off the blinking cursor.
Once you're in Mouse settings, select Additional mouse options from the links on the right side of the page. In Mouse Properties, on the Pointer Options tab, at the bottom, select Show location of pointer when I press the CTRL key, and then select OK. To see it in action, press CTRL.
In C#, you can use the following read-only textbox:
public class ReadOnlyTextBox : TextBox { [DllImport("user32.dll")] static extern bool HideCaret(IntPtr hWnd); public ReadOnlyTextBox() { this.ReadOnly = true; this.BackColor = Color.White; this.GotFocus += TextBoxGotFocus; this.Cursor = Cursors.Arrow; // mouse cursor like in other controls } private void TextBoxGotFocus(object sender, EventArgs args) { HideCaret(this.Handle); } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With