Using system;using system.drawing;using system.collections;using system.componentmodel;using System.Windows.Forms; Using system.data;using System.Runtime.InteropServices; Namespace example013_ A summary description of the drag {///<summary>///Form1 of the untitled form. </summary>public class form1:system.windows.forms.form{///<summary>///the required designer variables. </summary>private System.ComponentModel.Container components = Null;public Form1 () {////required for Windows Forms Designer support/ /initializecomponent ();////TODO: Add any constructor code after the InitializeComponent call//}///<summary>///clean up all the resources that are in use. </summary>protected override void Dispose (bool disposing) {if (disposing) {if (%! = NULL) {components. Dispose ();}} Base. Dispose (disposing);} #region Windows Form Designer generated code///<summary>///Designer supports the required methods-do not use the Code Editor to modify///The contents of this method. </summary>private void InitializeComponent () {System.ComponentModel.ComponentResourceManager resource s = new System.ComponentModel.ComponentResourceManager (typeof (Form1)); This. SuspendLayout (); Form1//this. AutoScaleBaseSize = new System.Drawing.Size (6, 14); This. BackgroundImage = ((System.Drawing.Image) (resources. GetObject ("$this. BackgroundImage "))); This. BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; This. ClientSize = new System.Drawing.Size (602, 381); This. FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; This. Name = "Form1"; This. Text = "Form1"; This. MouseDown + = new System.Windows.Forms.MouseEventHandler (this. Form1_mousedown); This. ResumeLayout (false);} #endregion The main entry point of the///<summary>///application. </summary>[stathread]static void Main () {Application.Run (New Form1 ());} [DllImport ("User32.dll")]public static extern bool ReleaseCapture (); [DllImport ("User32.dll")]public static extern bool SendMessage (IntPtr hwnd,int wmsg,int wparam,int lParam); Public Const int wm_syscommand=0x0112;public const int sc_move=0xf010;public const int htcaption=0x0002;private void Form1_ MouseDown (object sender, System.Windows.Forms.MouseEventArgs e) {releasecapture (); SendMessage (this. Handle,wm_syscommand,sc_move+htcaption, 0); }}}
C # non-banner form dragging