C# moving form without title bar moving windows form without border

Published: 04 December 2021
on channel: Improve Yourself
1,095
like

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);
}
}
}


Watch video C# moving form without title bar moving windows form without border online without registration, duration hours minute second in high quality. This video was added by user Improve Yourself 04 December 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,09 once and liked it lik people.