/// <summary> /// 位置改变时响应函数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_LocationChanged(object sender, EventArgs e) { //检查信息是否已初始化 if (IsInformationsInitialized) { //保存位置信息 AppInfoOperations.SetLeft(this.Left); AppInfoOperations.SetTop(this.Top); //更新Manage类的主窗体位置信息 Manage.WindowMainRect.left = (int)this.Left; Manage.WindowMainRect.right = (int)(this.Left + this.ActualWidth); Manage.WindowMainRect.top = (int)this.Top; Manage.WindowMainRect.bottom = (int)(this.Top + this.ActualHeight); //边缘吸附 if (this.Left <= 50 && this.Left > 0) { this.Left = 0; } if (this.Top <= 50 && this.Top > 0) { this.Top = 0; } } }