1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.ComponentModel;4 usingSystem.Data;5 usingSystem.Drawing;6 usingSystem.Linq;7 usingSystem.Text;8 usingSystem.Threading.Tasks;9 usingSystem.Windows.Forms;Ten One namespaceWingpchat.master A { - Public Partial classFormbase:form - { the Publicformbase () - { - InitializeComponent (); - } + PrivatePoint mpoint =NewPoint (); - Private voidFormbase_load (Objectsender, EventArgs e) + { A This. mousedown+=Formbase_mousedown; at This. mousemove+=Formbase_mousemove; - } - - protected voidFormbase_mousemove (Objectsender, MouseEventArgs e) - { - if(E.button = =mousebuttons.left) in { -Point myposittion =mouseposition; toMyposittion.offset (-mpoint.x,-mpoint.y); + This. Findform (). Location =myposittion; - } the } * $ protected voidFormbase_mousedown (Objectsender, MouseEventArgs e)Panax Notoginseng { -Mpoint.x =e.x; theMpoint.y =e.y; + } A the /// <summary> + ///rewrite paint to implement thin borders - /// </summary> $ /// <param name= "E" ></param> $ protected Override voidOnPaint (PaintEventArgs e) - { -Pen pen =NewPen (Color.gray,1); theE.graphics.drawline (pen,NewPoint (0,0),NewPoint ( This. width-1,0));//on -E.graphics.drawline (pen,NewPoint (0,0),NewPoint (0, This. height-1));//leftWuyiE.graphics.drawline (pen,NewPoint ( This. width-1,0),NewPoint ( This. width-1, This. height-1));//Right theE.graphics.drawline (pen,NewPoint (0, This. height-1),NewPoint ( This. width-1, This. height-1));//under - Base. OnPaint (e); Wu } - About /// <summary> $ ///No border Override click icon to maximize and minimize the form - /// </summary> - protected OverrideCreateParams CreateParams - { A Get + { theCreateParams CP =Base. CreateParams; -Cp. Style = CP. Style |0x20000;//allow minimization of operations $ returnCP; the } the } the the - } in}
Winform No Border window move custom border thickness color