Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Dragging a Borderless Form

0.00/5 (No votes)
12 Jun 2010 1  
The original snippet I made is in VB.NETProtected Overrides Sub WndProc(ByRef e As Message) MyBase.WndProc(e) If e.Msg = &H84 AndAlso e.Result = &H1 Then e.Result = &H2 End SubI used Reflector to translate it to C#protected override void WndProc(ref Message...
The original snippet I made is in VB.NET

VB
Protected Overrides Sub WndProc(ByRef e As Message)
       MyBase.WndProc(e)
       If e.Msg = &H84 AndAlso e.Result = &H1 Then e.Result = &H2
   End Sub



I used Reflector to translate it to C#

C#
protected override void WndProc(ref Message e)
{
    base.WndProc(ref e);
    if ((((e.Msg == 0x84) && (e.Result == ((IntPtr) 1))) ? 1 : 0) != 0)
    {
        e.Result = (IntPtr) 2;
    }
}


Nearly the same code, but the second condition I check for here is different.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here