C# moving form without title bar moving windows form without border
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Example
{
public partial class Form1 : Form
{
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int LPAR);
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
const int WM_NCLBUTTONDOWN = 0xA1;
const int HT_CAPTION = 0x2;
private void move_window(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(this.Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
}
public Form1()
{
InitializeComponent();
this.MouseDown += new MouseEventHandler(move_window);
}
}
}