靠边缩进.
private void Form1_MouseLeave(object sender, System.EventArgs e) {
const int j = 5; // 要故意露出在右上的高度 if (this.Top <1) { //如果当前X 已经是在最顶
// 并且Y 也已经在最右边
if (this.Left >= Screen.PrimaryScreen.WorkingArea.Width - this.Width) {
// 开始往上移
while(this.Top >= 0-this.Height + j) {
this.Top --;
}
}
}
}private void Form1_MouseEnter(object sender, System.EventArgs e) {
if (this.Top <0) {
// 这里是移回正常位置的代码你接上面的逆着做就是了
}
}