[RESOLVED] Moving borderless form - ERROR
Hi,
Found this code to move a borderless form, but gives me an error:
VB Code:
using Microsoft.Win32;
private const int WM_NCLBUTTONDOWN = 0xA1;
private const int HTCAPTION = 0x2;
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[ DllImport( "user32.dll" ) ]
public static extern int SendMessage( IntPtr hWnd, int Msg, int wParam, int lParam );
private System.Windows.Forms.Button cmdExit;
private System.ComponentModel.Container components = null;
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if ( e.Button == MouseButtons.Left )
{
ReleaseCapture();
SendMessage( Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0 );
}
}
The error says:
"The type or namespace DLLImport could not be found..."
Re: Moving borderless form - ERROR
Add this statement at the top
Code:
using System.Runtime.InteropServices;
Re: Moving borderless form - ERROR
Thanks!
I haven't seen that with any samples that I found (maybe it's a common knowledge).
Re: Moving borderless form - ERROR
Don't forget to resolve your thread from the Thread Tools menu.