private void btnEditRoute_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { OperationHelpDialog dlg = new OperationHelpDialog(); //车间名称 dlg.FactoryRoom = _factoryname; //dlg.FactoryRoom = "F5M7"; dlg.ProductType = string.Empty; dlg.EnterpriseName = btnEditRoute; dlg.RouteName = txtOperation; dlg.StepName = txtStep; dlg.IsRework = false; Point i = btnEditRoute.PointToScreen(new Point(0, 0)); dlg.StartPosition = System.Windows.Forms.FormStartPosition.Manual; Rectangle screenArea = System.Windows.Forms.Screen.GetWorkingArea(this); int screenWidth = Screen.PrimaryScreen.Bounds.Width; int screenHeight = Screen.PrimaryScreen.Bounds.Height; if ((screenWidth - i.X) > dlg.Width) { if ((screenHeight - i.Y) > dlg.Height) { dlg.Location = new Point(i.X, i.Y + btnEditRoute.Height); } else { dlg.Location = new Point(i.X, i.Y - dlg.Height); } } else { if ((screenHeight - i.Y) > dlg.Height) { dlg.Location = new Point(i.X + btnEditRoute.Width - dlg.Width, i.Y + btnEditRoute.Height); } else { dlg.Location = new Point(i.X + btnEditRoute.Width - dlg.Width, i.Y - dlg.Height); } } dlg.Visible = true; dlg.Show(); }
/// <summary> /// 选择新的工艺流程。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void beEnterpriseName_ButtonClick(object sender, ButtonPressedEventArgs e) { OperationHelpDialog dlg = new OperationHelpDialog(); dlg.FactoryRoom = this._model.RoomName; dlg.ProductType = string.Empty; dlg.EnterpriseName = beEnterpriseName; dlg.RouteName = teRouteName; dlg.StepName = teStepName; dlg.IsRework = true; Point i = teStepName.PointToScreen(new Point(0, 0)); dlg.StartPosition = System.Windows.Forms.FormStartPosition.Manual; Rectangle screenArea = System.Windows.Forms.Screen.GetWorkingArea(this); int screenWidth = Screen.PrimaryScreen.Bounds.Width; int screenHeight = Screen.PrimaryScreen.Bounds.Height; if ((screenWidth - i.X) > dlg.Width) { if ((screenHeight - i.Y) > dlg.Height) { dlg.Location = new Point(i.X, i.Y + teStepName.Height); } else { dlg.Location = new Point(i.X, i.Y - dlg.Height); } } else { if ((screenHeight - i.Y) > dlg.Height) { dlg.Location = new Point(i.X + teStepName.Width - dlg.Width, i.Y + teStepName.Height); } else { dlg.Location = new Point(i.X + teStepName.Width - dlg.Width, i.Y - dlg.Height); } } dlg.Visible = true; dlg.Show(); }