示例#1
0
        private bool ClickGridCheckBox(DevExpress.XtraGrid.Views.Grid.GridView gridView, string fieldName, bool currentStatus)
        {
            bool result = false;

            if (gridView != null)
            {
                //禁止排序
                gridView.ClearSorting();
                gridView.PostEditor();
                detailData.ClearSorting();
                detailData.PostEditor();
                DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo info;
                System.Drawing.Point pt = gridView.GridControl.PointToClient(Control.MousePosition);
                info = gridView.CalcHitInfo(pt);
                if (info.Column != null && info.Column.FieldName == fieldName)
                {
                    for (int i = 0; i < detailData.RowCount; i++)
                    {
                        detailData.SetRowCellValue(i, fieldName, !currentStatus);
                    }
                    return(true);
                }
            }
            return(result);
        }
示例#2
0
        /// <summary>
        /// 全选/全不选
        /// </summary>
        /// <param name="gridView"></param>
        /// <param name="fieldName"></param>
        /// <param name="currentStatus"></param>
        /// <returns></returns>
        private bool ClickGridCheckBox(DevExpress.XtraGrid.Views.Grid.GridView gridView, string fieldName, bool currentStatus)
        {
            try
            {
                bool result = false;

                if (gridView != null)
                {
                    gridView.PostEditor();

                    DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo info;

                    Point pt = gridView.GridControl.PointToClient(Control.MousePosition);

                    info = gridView.CalcHitInfo(pt);

                    if (info.InColumn && info.Column != null && info.Column.FieldName == fieldName)
                    {
                        for (int i = 0; i < gridView.RowCount; i++)
                        {
                            gridView.SetRowCellValue(i, fieldName, !currentStatus);
                        }

                        return(true);
                    }
                }

                return(result);
            }
            catch
            {
                return(false);
            }
        }
示例#3
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;
                }
            }
        }
示例#4
0
        private void grid_DoubleClick(object sender, EventArgs e)
        {
#if DebugTest
            Log += "-grid_DoubleClick";
#endif
            isDoubleClicking = false;
            if (DataRowDoubleClick != null)
            {
                if (gridView.FocusedRowHandle >= 0)
                {
                    DXMouseEventArgs args = DXMouseEventArgs.GetMouseArgs(grid, e);
                    if (args.Button == MouseButtons.Left)
                    {
                        GridHitInfo hitInfo = gridView.CalcHitInfo(args.Location);
                        if (hitInfo.InRow)
                        {
                            args.Handled = true;
                            DataRowDoubleClick(this, e);
                        }
                    }
                }
            }
        }
        private void DoRowDoubleClick(DevExpress.XtraGrid.Views.Grid.GridView view, Point pt)
        {
            GridHitInfo info = view.CalcHitInfo(pt);

            if (info.InRow || info.InRowCell)
            {
                string colCaption = info.Column == null ? "N/A" : info.Column.GetCaption();


                frmStockDetailReport frm = new frmStockDetailReport();
                StockReport          row = (StockReport)gridView.GetRow(info.RowHandle);
                frmStockDetailReport.Filterbject = row;
                frm.ShowDialog();
            }
        }
示例#6
0
        private void gridView_MouseDown(object sender, MouseEventArgs e)
        {
#if DebugTest
            Log += "-gridView_MouseDown";
#endif
            isDoubleClicking = false;
            DevExpress.XtraGrid.Views.Grid.GridView view = (DevExpress.XtraGrid.Views.Grid.GridView)sender;
            GridHitInfo hi = view.CalcHitInfo(new Point(e.X, e.Y));
            if ((hi != null) && (hi.RowHandle >= 0))
            {
                mouseDownTime = System.Environment.TickCount;
            }
            else
            {
                mouseDownTime = 0;
            }
        }
 private void gridView_MouseMove(object sender, MouseEventArgs e)
 {
     DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;
     if (view != null)
     {
         Point point = new Point(e.X, e.Y);
         DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo info = view.CalcHitInfo(point);
         foreach (var controller in this.buttonCells.Values)
         {
             if (info.InRowCell && IsMouseOverButton(info.RowHandle, controller.ColumnName, point))
             {
                 controller.HighlightedRowHandle = info.RowHandle;
             }
             else
             {
                 controller.HighlightedRowHandle = GridControl.InvalidRowHandle;
             }
         }
     }
 }
        private void view_MouseDown(object sender, MouseEventArgs e)
        {
            try
            {
                DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;

                _dragStartHitInfo = null;
                GridHitInfo hitInfo = view.CalcHitInfo(new Point(e.X, e.Y));

                if (!IsNewItemRowClicked(sender, e) && IsNewItemRowFocused(sender) && !IsNewItemRowEmpty(sender))
                {
                    (e as DXMouseEventArgs).Handled = true;
                }
                //gv.GetFocusedRowCellValue(strName).ToString();
                //if (IsNewItemRowClicked(sender, e))
                //{
                //foreach (GridColumn column in (view as GridView).Columns)
                //{
                //    switch (column.ColumnEdit.EditorTypeName)
                //    {
                //        case "LookUpEdit":
                //            column.View.Columns[0].Visible = false;
                //            //view.SetFocusedRowCellValue(column.Name, GetDefault(column.ColumnType));
                //            break;
                //    }
                //}
                //}

                if (System.Windows.Forms.Control.ModifierKeys != Keys.None)
                {
                    return;
                }
                if (e.Button == MouseButtons.Left && hitInfo.RowHandle >= 0)
                {
                    _dragStartHitInfo = hitInfo;
                }
            }
            catch (Exception ex)
            {
            }
        }
        private void gcDefAppt_MouseDown(object sender, MouseEventArgs e)
        {
            mouseDownHitInfo = null;
            //if another key is pressed at the same time as the mouse is pressed down ie combination keys
            if (ModifierKeys != Keys.None)
            {
                return;
            }
            GridHitInfo hitInfo = gvDefAppt.CalcHitInfo(e.Location);// new Point(e.X, e.Y));

            if (hitInfo.InRow && hitInfo.HitTest != GridHitTest.RowIndicator)
            {
                //check if there are any calendars visible, this is to make sure a job can be booked against someone.
                if (e.Button == MouseButtons.Left)
                {
                    mouseDownHitInfo = hitInfo;
                }

                //if (e.Button == MouseButtons.Right)
                //could extend it here with info??
            }
        }
示例#10
0
        /// <summary>
        /// 单击表格空间列头按钮
        /// </summary>
        /// <param name="gridView"></param>
        /// <param name="fieldName"></param>
        /// <param name="currentStatus"></param>
        /// <returns></returns>
        public bool ClickGridCheckBox(DevExpress.XtraGrid.Views.Grid.GridView gridView, bool currentStatus)
        {
            bool result = false;

            if (gridView != null)
            {
                gridView.ClearSorting();//禁止排序

                gridView.PostEditor();
                DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo info;
                Point pt = gridView.GridControl.PointToClient(Control.MousePosition);
                info = gridView.CalcHitInfo(pt);
                if (info.InColumn && info.Column != null && info.Column.FieldName == _column.FieldName)
                {
                    for (int i = 0; i < gridView.RowCount; i++)
                    {
                        gridView.SetRowCellValue(i, _column, !currentStatus);
                    }
                    return(true);
                }
            }
            return(result);
        }
示例#11
0
        private void gridMaster_DoubleClick(object sender, EventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi =
                gridMasterView.CalcHitInfo((sender as System.Windows.Forms.Control).PointToClient(System.Windows.Forms.Control.MousePosition));
            DataRow FocusRow;

            if (hi.RowHandle >= 0)
            {
                int nCategory = 99;
                FocusRow = gridMasterView.GetDataRow(hi.RowHandle);
                if (FocusRow.ItemArray[0].ToString() == "Fitness Package")
                {
                    nCategory = 1;
                }
                else if (FocusRow.ItemArray[0].ToString() == "Spa Package")
                {
                    nCategory = 2;
                }
                else if (FocusRow.ItemArray[0].ToString() == "Fitness Product")
                {
                    nCategory = 3;
                }
                else if (FocusRow.ItemArray[0].ToString() == "Spa Product")
                {
                    nCategory = 4;
                }
                else if (FocusRow.ItemArray[0].ToString() == "PT Package")
                {
                    nCategory = 5;
                }
                ACMS.ACMSManager.Human_Resource.Reports.RPAllIncomeDetail frm = new ACMS.ACMSManager.Human_Resource.Reports.RPAllIncomeDetail(FocusRow.ItemArray[0].ToString(), nCategory, dtDateDay.SelectionStart, oUser.NEmployeeID());
                frm.Show();
                //ACMS.ACMSStaff.WorkFlow.MyCustomEditForm frm = new ACMS.ACMSStaff.WorkFlow.MyCustomEditForm((int)FocusRow.ItemArray[0], nDepartment);
                //frm.Show();
            }
        }