"Julie" <ju***@nospam.com> wrote in message
news:40***************@nospam.com...
"Harry J. Smith" wrote:
"Julie" <ju***@nospam.com> wrote in message
news:40***************@nospam.com... "Harry J. Smith" wrote:
>
> How can you detect a mouse double click on a text box? I tried the
following > but it does not work.
>
> private void richTextOut_MouseUp(object sender,
> System.Windows.Forms.MouseEventArgs e)
>
> // Process Mouse up in output TextBox
>
> {
>
> if (e.Clicks == 1) // if a single click (always == 1 ??)
>
> {
>
> SelectCom();
>
> }
>
> if (e.Clicks == 2) // if a double click (never == 2 ??)
>
> {
>
> SelectCom();
>
> buttonDoIt_Click(sender, e);
>
> }
>
> }
>
> -Harry
You need to set the window style to accept double click events.
I couldn't figure out how to do that.
-Harry
Look into ControlStyles.StandardDoubleClick and the Control.DoubleClick
event.
This is the code I have entered. It compiles but the _Click and _DoubleClick
code is never entered:
this.richTextOut.Click += new System.EventHandler(this.richTextOut_Click);
this.richTextOut.Click += new
System.EventHandler(this.richTextOut_DoubleClick
this.SetStyle(ControlStyles.StandardClick |
ControlStyles.StandardDoubleClick,
private void richTextOut_Click(object sender, System.EventArgs e)
{
...
}
private void richTextOut_DoubleClick(object sender, System.EventArgs e)
{
....
}
-Harry