Winform No Border window move custom border thickness color

Source: Internet
Author: User

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

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.