C # non-banner form dragging

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.