Beispiel #1
0
 void DoShowMenu(DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi)
 {
     if (hi.HitTest == DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitTest.RowCell)
     {
         popupMenu1.ShowPopup(Control.MousePosition);
     }
 }
Beispiel #2
0
        private void gvFunction_DoubleClick(object sender, EventArgs e)
        {
            GridView view = (GridView)sender;
            Point    pt   = view.GridControl.PointToClient(Control.MousePosition);

            DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo info = view.CalcHitInfo(pt);
            if (info.InRow || info.InRowCell)
            {
                DataTable dtCP = (DataTable)gcFunction.DataSource;
                if (dtCP.Rows.Count > 0)
                {
                    lblStatus.Text      = "* Edit Function";
                    lblStatus.ForeColor = Color.Red;

                    DataRow drCP = dtCP.Rows[info.RowHandle];
                    txeID.Text          = drCP["ID"].ToString();
                    glueGroup.EditValue = drCP["GroupID"].ToString();
                    txeCode.Text        = drCP["Function No."].ToString();
                    txeName.Text        = drCP["FunctionName"].ToString();
                    txeVersion.Text     = drCP["Version"].ToString();
                    txeBrowse.Text      = drCP["PathFile"].ToString();
                    rgStatus.EditValue  = Convert.ToInt32(drCP["StatusID"].ToString());
                    //txeName.ReadOnly = true;
                    txeCREATE.Text = drCP["Created By"].ToString();
                    txeDATE.Text   = drCP["Created Date"].ToString();
                }
            }
        }
Beispiel #3
0
        private void gvUser_DoubleClick(object sender, EventArgs e)
        {
            GridView view = (GridView)sender;
            Point    pt   = view.GridControl.PointToClient(Control.MousePosition);

            DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo info = view.CalcHitInfo(pt);
            if (info.InRow || info.InRowCell)
            {
                DataTable dtCP = (DataTable)gcUser.DataSource;
                if (dtCP.Rows.Count > 0)
                {
                    lblStatus.Text      = "* Edit User";
                    lblStatus.ForeColor = Color.Red;

                    DataRow drCP = dtCP.Rows[info.RowHandle];
                    txeID.Text = drCP["User ID"].ToString();

                    txeUserName.Text         = drCP["UserName"].ToString();
                    txeFullName.Text         = drCP["FullName"].ToString();
                    txtPassword.Text         = drCP["Password"].ToString();
                    glueCompany.EditValue    = drCP["Company ID"].ToString();
                    glueBranch.EditValue     = drCP["Branch ID"].ToString();
                    glueDepartment.EditValue = drCP["Department ID"].ToString();
                    rgStatus.EditValue       = Convert.ToInt32(drCP["StatusID"].ToString());

                    LoadFunction(txeID.Text.Trim());
                }
            }
        }
 // 弹出右键菜单
 private void gridViewResultList_MouseUp(object sender, MouseEventArgs e)
 {
     DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = this.gridViewResultList.CalcHitInfo(e.Location);
     if (hi.InRow && e.Button == MouseButtons.Right)
     {
         popupMenu.ShowPopup(Control.MousePosition);
     }
 }
Beispiel #5
0
 /// <summary>
 /// 非新增或編輯狀態下雙擊打開編輯窗體
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvDetails_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left && e.Clicks == 2) // 判断是否是用鼠标双击
     {
         DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo ghi = dgvDetails.CalcHitInfo(new Point(e.X, e.Y));
         if (ghi.InRow)  // 判断光标是否在行内
         {
             Open_Edit_Window();
         }
     }
 }
 /// <summary>
 /// 双击时间,显示需要UPDATE 的数据
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void grdView1_MouseDown_1(object sender, MouseEventArgs e)
 {
     DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hInfo = grdView1.CalcHitInfo(new Point(e.X, e.Y));
     if (e.Button == MouseButtons.Left && e.Clicks == 2)
     { //判断光标是否在行范围内
         if (hInfo.InRow)
         {
             update();
         }
     }
 }
Beispiel #7
0
        private void grvData_DoubleClick(object sender, EventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.GridView sndr =
                sender as DevExpress.XtraGrid.Views.Grid.GridView;
            DevExpress.Utils.DXMouseEventArgs dxMouseEventArgs =
                e as DevExpress.Utils.DXMouseEventArgs;
            DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hitInfo =
                sndr.CalcHitInfo(dxMouseEventArgs.Location);

            if (hitInfo.InColumn)
            {
                grvHistory.ShowCustomFilterDialog(hitInfo.Column);
            }
            else
            {
                int id = TextUtils.ToInt(grvData.GetFocusedRowCellValue(grvData.Columns[0]));
                dtOne = dtAllMaterial.Select("ID = " + id).CopyToDataTable();
                if (!_vtd)
                {
                    dtOne.Rows.Clear();
                    DataRow row = dtOne.NewRow();
                    dtOne.Rows.Add(row);
                }

                dtOne.Columns[0].Caption = "ID";
                dtOne.Columns[1].Caption = "Mã";
                dtOne.Columns[2].Caption = "Tên";
                dtOne.Columns[3].Caption = "Hãng";
                dtOne.Columns[4].Caption = "Giá(VNĐ)";
                dtOne.Columns[5].Caption = "Thời gian GH(Ngày)";
                dtOne.Columns[6].Caption = "Ngày GD gần nhất";

                grvData.Columns[4].DisplayFormat.FormatType   = FormatType.Numeric;
                grvData.Columns[4].DisplayFormat.FormatString = "{0:#,##0.####}";

                grvOne.PopulateColumns(dtOne);
                grdOne.DataSource         = dtOne;
                grvOne.Columns[0].Visible = false;

                try
                {
                    pictureBox1.ImageLocation = ((MaterialModel)MaterialBO.Instance.FindByPK(id)).ImagePath;
                }
                catch (Exception)
                {
                }

                for (int i = 0; i < grvOne.Columns.Count; i++)
                {
                    grvOne.Columns[i].Width = grvData.Columns[i].Width;
                }
            }
        }
Beispiel #8
0
        private void gcWaitPst_Click(object sender, EventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi =
                gvTradePst.CalcHitInfo((sender as Control).PointToClient(Control.MousePosition));

            GridView view = gcWaitPst.GetViewAt(Control.MousePosition) as GridView;

            if (hi.RowHandle >= 0)
            {
                DataRow row = gvOrderPst.GetDataRow(hi.RowHandle);
            }
        }
Beispiel #9
0
        void vw_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            var gv = sender as DevExpress.XtraGrid.Views.Grid.GridView;

            DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo ghi = gv.CalcHitInfo(e.X, e.Y);
            if (e.Button == System.Windows.Forms.MouseButtons.Left && e.Clicks == 2)
            {
                if (ghi.InRow)
                {
                    if (null != ViewMouseDoubleClick)
                    {
                        ViewMouseDoubleClick(sender, e);
                    }
                }
            }
        }
 /// <summary>
 /// 列表双击事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void gridViewConsultation_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hitInfo =
             gridViewConsultation.CalcHitInfo(gridControlConsultation.PointToClient(Cursor.Position));
         if (hitInfo.RowHandle >= 0)
         {
             OpenConsultationInfo(hitInfo.RowHandle);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #11
0
 /// <summary>
 /// 双击事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void gridView_报表管理_MouseDown(object sender, MouseEventArgs e)
 {
     try
     {
         DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hInfo = gridView_报表管理.CalcHitInfo(new Point(e.X, e.Y));
         if (e.Button == MouseButtons.Left && e.Clicks == 2)
         {
             if (hInfo.InRow)
             {
                 int rowHandle = hInfo.RowHandle;
                 //更新当前已选中报表
                 TestReportCurrentSelected = gridView_报表管理.GetRow(rowHandle) as TestReport测试报表信息;
                 new ChildModuleOf查看报表().Show();
             }
         }
     }
     catch (Exception) {
     }
 }
 /// <summary>
 /// 双击事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void gridControl_批次信息表_MouseDown(object sender, MouseEventArgs e)
 {
     try
     {
         DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hInfo = gridView_批次信息表.CalcHitInfo(new Point(e.X, e.Y));
         if (e.Button == MouseButtons.Left && e.Clicks == 2)
         {
             if (hInfo.InRow)
             {
                 int rowHandle = hInfo.RowHandle;
                 //更新已选批次信息
                 UUT批次信息Selected = gridView_批次信息表.GetRow(rowHandle) as UUT批次信息;
                 new ChildModuleOf批次详细信息().Show();
             }
         }
     }
     catch (Exception)
     {
     }
 }
 protected override void DoStartResize(DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hit)
 {
     if (hit.HitTest == GridHitTest.ColumnEdge)
     {
         BandedGridHitInfo hi        = new BandedGridHitInfo();
         GridBand          ownerBand = (hit as BandedGridHitInfo).Column.OwnerBand;
         hi.Band    = ownerBand;
         hi.HitTest = BandedGridHitTest.BandEdge;
         if (IsHitPointAtTheEdge(hit))
         {
             base.DoStartResize(hi);
         }
         else
         {
             base.DoStartResize(hit);
         }
     }
     else
     {
         base.DoStartResize(hit);
     }
 }
Beispiel #14
0
 private void gvr_MouseDown(object sender, MouseEventArgs e)
 {
     DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hInfo = gvr.CalcHitInfo(new Point(e.X, e.Y));
     flag = hInfo.InDataRow;
 }
Beispiel #15
0
        protected void Initialize()
        {
            if (!DesignMode)
            {
                Grid.MainView = View;
                Grid.ViewCollection.Add(View);
                view.GridControl = Grid;

                #region GridView

                View.OptionsSelection.EnableAppearanceHideSelection = false;
                View.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
                View.OptionsView.ShowIndicator    = false;
                View.OptionsSelection.MultiSelect = true;
                View.Appearance.Row.Font          = this.Font;
                View.Appearance.HeaderPanel.Font  = this.Font;
                View.OptionsView.ShowGroupPanel   = false;
                View.OptionsBehavior.Editable     = false;


                //View.OptionsCustomization.AllowFilter = false;
                //View.OptionsCustomization.AllowSort = false;
                //View.OptionsCustomization.AllowColumnMoving = false;
                //View.OptionsCustomization.AllowColumnResizing = false;
                //View.OptionsCustomization.AllowQuickHideColumns = false;
                //View.OptionsSelection.EnableAppearanceFocusedCell = false;
                //View.FocusRectStyle = DrawFocusRectStyle.None;

                View.Click += (o, e) =>
                {
                    #region Click
                    if (!IsDoubleClickSelect)
                    {
                        ClosePopupCore();
                    }
                    #endregion
                };

                View.MouseUp += (o, e) =>
                {
                    DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = View.CalcHitInfo(e.Location);
                    if (hi.HitTest == GridHitTest.EmptyRow && e.Button == MouseButtons.Right)
                    {
                        Grid.ShowConfigPopMenu();
                    }
                };

                View.DoubleClick += (o, e) =>
                {
                    #region DoubleClick
                    if (IsDoubleClickSelect)
                    {
                        ClosePopupCore();
                    }
                    #endregion
                };
                View.SelectionChanged += (o, e) =>
                {
                    if (View.SelectedRowsCount > 1)
                    {
                        View.ClearSelection();
                        SelectRow(View.FocusedRowHandle);
                    }
                };
                View.CustomDrawRowIndicator += (o, e) =>
                {
                    #region CustomDrawRowIndicator
                    if (e.Info.IsRowIndicator && e.RowHandle >= 0)
                    {
                        e.Info.DisplayText = (e.RowHandle + 1).ToString();
                        e.Info.ImageIndex  = -1;
                    }
                    #endregion
                };

                #endregion

                #region Grid

                Grid.Dock = System.Windows.Forms.DockStyle.Fill;
                Grid.IsShowColumnHeardMenu = false;
                Grid.TabIndex = 0;
                Grid.TabStop  = false;
                Grid.Font     = this.Font;

                Grid.ProcessGridKey += (o, e) =>
                {
                    #region ProcessGridKey
                    if (View.IsGroupRow(View.FocusedRowHandle))
                    {
                        return;
                    }

                    if (e.KeyCode == Keys.Enter)
                    {
                        ClosePopupCore();
                        e.Handled = true;
                    }
                    else if ((e.KeyValue >= 65 && e.KeyValue <= 90) ||
                             (e.KeyValue >= 48 && e.KeyValue <= 57))
                    {
                        this.Text          += Convert.ToChar(e.KeyValue).ToString();
                        this.SelectionStart = this.Text.Length;
                        e.Handled           = true;
                    }
                    else if (e.KeyCode == Keys.Delete && e.KeyCode == Keys.Back)
                    {
                        ResetPopup();
                        e.Handled = true;
                    }
                    #endregion
                };

                #endregion

                #region PopupContainer

                PopupContainer.TabIndex = 0;
                PopupContainer.TabStop  = false;
                PopupContainer.Controls.Add(Grid);
                #endregion


                this.QueryCloseUp += (o, e) =>
                {
                    if (isClick)
                    {
                        e.Cancel = true;
                    }
                };


                this.Properties.ShowPopupCloseButton = false;
                this.Properties.TextEditStyle        = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
                this.Properties.PopupControl         = PopupContainer;

                SetPopupContainerSize();
                OnLoadData();
                this.Grid.ForceInitialize();
            }
        }