No ink,:
Online to see, a lot of answers garbled seven bad, are all nonsense, so write their own code as follows:
The size of the form is temporarily set to: (598, 362) The red data is changed according to your form size
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Drawing.Drawing2D;usingSystem.Runtime.InteropServices;namespacewindemo{ Public Partial classForm5:form { PublicFORM5 () {InitializeComponent (); } /// <summary> ///button to redraw the event/// </summary> /// <param name= "Sender" ></param> /// <param name= "E" ></param> Private voidButton1_paint (Objectsender, PaintEventArgs e) {GraphicsPath MyPath=NewGraphicsPath (); Rectangle rect=NewRectangle (0,0,574,362);//back 2 data resizing form sizeMypath.addrectangle (rect); This. Region =NewRegion (MyPath); } [DllImport ("user32.dll")] Static extern intReleaseDC (IntPtr hWnd, IntPtr HDC); [DllImport ("User32.dll")] Private Static externIntPtr GETWINDOWDC (IntPtr hWnd); protected Override voidWndProc (refSystem.Windows.Forms.Message m) { Const intWm_ncpaint =0x85; Base. WndProc (refm); if(M.msg = =wm_ncpaint) {INTPTR hdc=GETWINDOWDC (M.hwnd); if((int) HDC! =0) {Graphics g=GRAPHICS.FROMHDC (HDC); Pen Pen1=NewPen (Color.FromArgb ( -, -, -)); Pen Pen2=NewPen (Color.FromArgb ( -, -, -)); Pen Pen3=NewPen (Color.FromArgb (212,208, $)); G.drawline (Pen1,573,0,573, the);//On the outsideG.drawline (Pen2,572,1,572,359);//the outermost second strip of whiteG.drawline (Pen3,571,2,571,359); G.drawline (Pen3,571,2,571,359); G.flush (); ReleaseDC (M.hwnd, HDC); } } } Private voidForm5_mousecapturechanged (Objectsender, EventArgs e) {Graphics g= This. CreateGraphics (); Pen Pen1=NewPen (Color.FromArgb ( -, -, -)); Pen Pen2=NewPen (Color.FromArgb ( -, -, -)); Pen Pen3=NewPen (Color.FromArgb (212,208, $)); G.drawline (Pen1,573,0,573, the);//On the outsideG.drawline (Pen2,572,1,572,359);//the outermost second strip of whiteG.drawline (Pen3,571,2,571,359); G.drawline (Pen3,571,2,571,359); G.flush (); } }}
Original link: http://zydcomputer.blog.163.com/blog/static/12427188120121102021528/
Winform Remove the Maximize minimize close button (not turn off button dimmed) the ultimate solution