A
> Adrian
Is there a way of stopping text from highlighting in textbox?
Many thanks,
Adrian.
Many thanks,
Adrian.
Is there a way of stopping text from highlighting in textbox?
Many thanks,
Adrian.
Is there a way of stopping text from highlighting in textbox?
Many thanks,
Adrian.
Supposing I have a textbox with a text. Then as soon as - later on - I do
something in the same textbox, with the text still there, say I want to
click the textbox for some action, I risk some of the text getting
"highlight". I want to stop that from happening.
Adrian.
- Show quoted text -
control class.
Feel free to ask any further questions.
{
textBox1.DeselectAll();
}
private void textBox1_DoubleClick(object sender, EventArgs e)
{
textBox1.DeselectAll();
}
No it didn't do the trick> Adrian said:This will do the trick I guess.
I am very pleased with your solution.
Thank you for responding.
Adrian
Supposing I have a textbox with a text. Then as soon as - later on - I do
something in the same textbox, with the text still there, say I want to
click the textbox for some action, I risk some of the text getting
"highlight". I want to stop that from happening.
Adrian.
- Show quoted text -
you are still in same textbox.
Supposing I have a textbox with a text. Then as soon as - later on - I do
something in the same textbox, with the text still there, say I want to
click the textbox for some action, I risk some of the text getting
"highlight". I want to stop that from happening.
Peter Duniho said:Do you want to disable all mouse interaction with the control except for
the click? Or do you want to still preserve the ability to move the
insertion caret with the mouse?
It seems to me that either way, you should be able to do what you want by
overriding the OnMouse... methods() in the control. It does mean you have
to create your own custom control that inherits from TextBox, but it
should work fine. If you want to disable all mouse interaction, then
simply write the overrides and then do nothing in them. If you just want
to disable selection, then you may be able to do that by making the
OnMouseDown() method do nothing, and then in OnMouseUp() call both the
base OnMouseDown() method and the base OnMouseUp() method with the same
event args (so that it looks to the base class as if the mouse was clicked
in a single spot).
I will reiterate my usual warning against unnecessarily disabling or
changing standard functionality. But if you have a genuinely important
need to do this, I think the above might work.
Pete
Peter Duniho said:Do you want to disable all mouse interaction with the control except for
the click? Or do you want to still preserve the ability to move the
insertion caret with the mouse?
It seems to me that either way, you should be able to do what you want by
overriding the OnMouse... methods() in the control. It does mean you have
to create your own custom control that inherits from TextBox, but it
should work fine. If you want to disable all mouse interaction, then
simply write the overrides and then do nothing in them. If you just want
to disable selection, then you may be able to do that by making the
OnMouseDown() method do nothing, and then in OnMouseUp() call both the
base OnMouseDown() method and the base OnMouseUp() method with the same
event args (so that it looks to the base class as if the mouse was clicked
in a single spot).
I will reiterate my usual warning against unnecessarily disabling or
changing standard functionality. But if you have a genuinely important
need to do this, I think the above might work.
Pete
[...]you should be able to do what you want by
overriding the OnMouse... methods() in the control. It does mean you
have
to create your own custom control that inherits from TextBox, but it
should work fine. If you want to disable all mouse interaction, then
simply write the overrides and then do nothing in them. If you just
want
to disable selection, then you may be able to do that by making the
OnMouseDown() method do nothing, and then in OnMouseUp() call both the
base OnMouseDown() method and the base OnMouseUp() method with the same
event args (so that it looks to the base class as if the mouse was
clicked
in a single spot).
It didn't work I'm afraid to say.