代码如下: namespace KM { public partial class Test : Form { public Test() { InitializeComponent(); } private void Test_Load(object sender, EventArgs e) { System.Windows.Forms.Timer StopRectTimer = new System.Windows.Forms.Timer(); StopRectTimer.Tick += new EventHandler(timer1_Tick); StopRectTimer.Interval =100; StopRectTimer.Enabled = true; this.TopMost = true; StopRectTimer.Start(); } private void timer1_Tick(object sender, EventArgs e) { if (this.Bounds.Contains(Cursor.Position)) { switch (this.StopAanhor) { case AnchorStyles.Top: this.Location = new Point(this.Location.X, 0); break;