1、自定义控件
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace PartApp.Uc
{public class And:Control{private bool dragging = false;private Point dragCursorPoint;private Point dragFormPoint;public And(){SetStyle(ControlStyles.OptimizedDoubleBuffer, true);this.MouseUp += And_MouseUp;this.MouseMove += And_MouseMove;this.MouseDown += And_MouseDown;}private void And_MouseDown(object sender, MouseEventArgs e){dragging = true;dragCursorPoint = Cursor.Position;dragFormPoint = this.Location;}private void And_MouseMove(object sender, MouseEventArgs e){if (dragging){Point dif = Point.Subtract(Cursor.Position, new Size(dragCursorPoint));this.Location 