Пример #1
0
        /// <summary>
        /// 显示原因代码组查询对话框。
        /// </summary>
        /// <param name="btClickButton"></param>
        /// <param name="clickTransactType"></param>
        private void ShowReasonCodeQueryHelpDialog(ButtonEdit sender)
        {
            ReasonCodeCategoryQueryType type = ReasonCodeCategoryQueryType.None;

            if (sender == this.beDefectReasonCode)
            {
                type = ReasonCodeCategoryQueryType.Defect;
            }
            else if (sender == this.beScrapReasonCode)
            {
                type = ReasonCodeCategoryQueryType.Scrap;
            }
            ReasonCodeCategoryQueryHelpModel model = new ReasonCodeCategoryQueryHelpModel()
            {
                QueryType = type
            };
            ReasonCodeCategoryQueryHelpDialog dlg = new ReasonCodeCategoryQueryHelpDialog(model);

            if (sender == this.beScrapReasonCode)
            {
                dlg.OnValueSelected += new ReasonCodeCategoryQueryValueSelectedEventHandler(Scrap_OnValueSelected);
            }
            else if (sender == this.beDefectReasonCode)
            {
                dlg.OnValueSelected += new ReasonCodeCategoryQueryValueSelectedEventHandler(Defect_OnValueSelected);
            }
            Point i = sender.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 = sender.Width;
            if ((screenWidth - i.X) > dlg.Width)
            {
                if ((screenHeight - i.Y) > dlg.Height)
                {
                    dlg.Location = new Point(i.X, i.Y + sender.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 + sender.Width - dlg.Width, i.Y + sender.Height);
                }
                else
                {
                    dlg.Location = new Point(i.X + sender.Width - dlg.Width, i.Y - dlg.Height);
                }
            }
            dlg.Visible = true;
            dlg.Show();
        }
Пример #2
0
 /// <summary>
 /// 构造函数。
 /// </summary>
 /// <param name="transactType"></param>
 public ReasonCodeCategoryQueryHelpDialog(ReasonCodeCategoryQueryHelpModel model)
 {
     InitializeComponent();
     this._model = model;
 }