"Julie" <ju***@nospam.c om> wrote in message
news:40******** *******@nospam. com...
"Harry J. Smith" wrote:
"Julie" <ju***@nospam.c om> 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_Mou seUp(object sender,
> System.Windows. Forms.MouseEven tArgs 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_Clic k(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.S tandardDoubleCl ick and the Control.DoubleC lick
event.
This is the code I have entered. It compiles but the _Click and _DoubleClick
code is never entered:
this.richTextOu t.Click += new System.EventHan dler(this.richT extOut_Click);
this.richTextOu t.Click += new
System.EventHan dler(this.richT extOut_DoubleCl ick
this.SetStyle(C ontrolStyles.St andardClick |
ControlStyles.S tandardDoubleCl ick,
private void richTextOut_Cli ck(object sender, System.EventArg s e)
{
...
}
private void richTextOut_Dou bleClick(object sender, System.EventArg s e)
{
....
}
-Harry