Form move
//Form Mobile API[DllImport ("user32.dll")] Public Static extern BOOLreleasecapture (); [DllImport ("user32.dll")] Public Static extern BOOLSendMessage (INTPTR hwnd,intWmsg,intWParam,intiparam); Public Const intWm_syscommand =0x0112; Public Const intSc_move =0xf010; Public Const intHtcaption =0x0002; [DllImport ("User32")]Private Static extern intSendMessage (INTPTR hwnd,intWmsg,intWParam, IntPtr lParam);Private Const intWm_setredraw =0xB;Private voidForm1_mousedown (Objectsender, MouseEventArgs e) { if( This. WindowState = =formwindowstate.normal) {releasecapture (); SendMessage ( This. Handle, Wm_syscommand, Sc_move + htcaption,0); }}
View Code
Form Shadows
1, add namespaces:usingSystem.Runtime.InteropServices; 2, define constant values and functions:Private Const intCs_dropshadow =0x20000; Private Const intGcl_style = (- -); [DllImport ("user32.dll", CharSet =CharSet.Auto)] Public Static extern intSetclasslong (INTPTR hwnd,intNIndex,intDwnewlong); [DllImport ("user32.dll", CharSet =CharSet.Auto)] Public Static extern intGetclasslong (INTPTR hwnd,intnIndex);3, constructed by reference: Setclasslong ( This. Handle, Gcl_style, Getclasslong ( This. Handle, Gcl_style) | Cs_dropshadow);
View Code
WinForm Form API Move API Shadow