The code here is a size or position used to simulate the adjustment of a window (preferably no side form), interesting, feel easy to play, bring to you, hope that the high people will point to Improved procedures (modified), use this method to do Window form control, so you can adjust your control size or location at runtime, pay attention to use WNDPROC:
Using system.drawing; using system.windows.forms;
A summary description of Namespace Size_MoveForm {///
Public formbase () {// // Windows Form Designer Support for // InitializeComponent ();
// // Todo: Add any constructor code after INITIALIZEComponent call //}
///
#REGION Windows Form Designer The code ///
} #Endregion
Private const INT WM_NCHITTEST = 0x84; // Move the mouse, press and hold or release the system message occurred when the mouse occurs private const INT HTCLIENT = 0x1; // Workspace private const port htsysmenu = 3; // System menu private const Int htcaption = 0x2 ; //title
Private const Int htleft = 10; // To left private const Int htright = 11; // To right private const Int httop = 12; // to the top left private const Int httopright = 14; // upper right private const int HTBOTTOM = 15; // private downwardly const int HTBOTTOMLEFT = 16; // the left private const int HTBOTTOMRIGHT = 17; // the right private int m_BorderWidth = 2; private int m_CaptionHeight = 20; Private const Int borderwidth = 5; // ourselves defined the width of the form side
/ / Can adjust the size of the form and the position of the mobile form protected override void wndproc (REF Message M) {if (M.MSG == WM_NCHITTEST) {base.WndProc (Ref m); if (designMode) {return;} IF ((int) m.Result == htclient) {m.hwnd = this.handle;
System.drawing.Rectangle Rect = this.Rectangletoscreen (this.clientRectangle); Point C_POS = Cursor.position;