private void btnLotNumber_ButtonClick(object sender, ButtonPressedEventArgs e) { LotQueryHelpModel model = new LotQueryHelpModel(); model.RoomKey = Convert.ToString(this.lueFactoryRoom.EditValue); model.OperationType = LotOperationType.Scrap; LotQueryHelpDialog dlg = new LotQueryHelpDialog(model); dlg.OnValueSelected += new LotQueryValueSelectedEventHandler(btnLotQueryHelpDialog_OnValueSelected); Point i = btnLotNumber.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; dlg.Width = btnLotNumber.Width; if ((screenWidth - i.X) > dlg.Width) { if ((screenHeight - i.Y) > dlg.Height) { dlg.Location = new Point(i.X, i.Y + btnLotNumber.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 + btnLotNumber.Width - dlg.Width, i.Y + btnLotNumber.Height); } else { dlg.Location = new Point(i.X + btnLotNumber.Width - dlg.Width, i.Y - dlg.Height); } } dlg.Visible = true; dlg.Show(); }
/// <summary> /// 构造函数。 /// </summary> /// <param name="model">批次查询操作所需参数。</param> public LotQueryHelpDialog(LotQueryHelpModel model) { InitializeComponent(); this._model = model; }