Home All Groups Group Topic Archive Search About

Catch Title bar double click

Author
1 Apr 2005 8:59 PM
Marty
Hi,

I stuck on basic thing today...

How can I caych the double click event when it is done on the title bar
of a form.  I just want my form to be expanded or shrinked when the user
dbl-click.

Thanks,
Marty

Author
1 Apr 2005 9:16 PM
Crouchie1998
Look up the HTCAPTION constant

Crouchie1998
BA (HONS) MCP MCSE



"Marty" <xmart***@hotmail.com> wrote in message
news:pCi3e.125552$ZO2.98148@edtnps84...
Show quoteHide quote
> Hi,
>
> I stuck on basic thing today...
>
> How can I caych the double click event when it is done on the title bar
> of a form.  I just want my form to be expanded or shrinked when the user
> dbl-click.
>
> Thanks,
> Marty
Author
1 Apr 2005 9:16 PM
Herfried K. Wagner [MVP]
"Marty" <xmart***@hotmail.com> schrieb:
> How can I caych the double click event when it is done on the title bar
> of a form.  I just want my form to be expanded or shrinked when the user
> dbl-click.

\\\
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
    Static Expanded As Boolean = True
    Static Height As Integer
    Const WM_NCLBUTTONDBLCLK As Int32 = &HA3
    If m.Msg = WM_NCLBUTTONDBLCLK Then
        If Expanded Then
            Height = Me.Height
            Me.Height = 0
        Else
            Me.Height = Height
        End If
        Expanded = Not Expanded
    End If
    MyBase.WndProc(m)
End Sub
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
1 Apr 2005 9:35 PM
Marty
Thank you, exactly what I needed.
Marty

Herfried K. Wagner [MVP] wrote:

Show quoteHide quote
> "Marty" <xmart***@hotmail.com> schrieb:
>
>> How can I caych the double click event when it is done on the title
>> bar of a form.  I just want my form to be expanded or shrinked when
>> the user dbl-click.
>
>
> \\\
> Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
>    Static Expanded As Boolean = True
>    Static Height As Integer
>    Const WM_NCLBUTTONDBLCLK As Int32 = &HA3
>    If m.Msg = WM_NCLBUTTONDBLCLK Then
>        If Expanded Then
>            Height = Me.Height
>            Me.Height = 0
>        Else
>            Me.Height = Height
>        End If
>        Expanded = Not Expanded
>    End If
>    MyBase.WndProc(m)
> End Sub
> ///
>