Example #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();
        }
Example #2
0
 private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (e.Button.Kind == ButtonPredefines.Ellipsis)
     {
         MessageBox.Show("This is a dialog box.");
     }
     if (e.Button.Kind == ButtonPredefines.Combo)
     {
         ButtonEdit                 editor = sender as ButtonEdit;
         ButtonEditViewInfo         evi    = editor.GetViewInfo() as ButtonEditViewInfo;
         EditorButtonObjectInfoArgs bvi    = evi.ButtonInfoByButton(e.Button);
         Point pt = new Point(bvi.Bounds.Left, bvi.Bounds.Bottom);
         pt = editor.PointToScreen(pt);
         popupMenu1.ShowPopup(pt);
     }
 }