Ejemplo n.º 1
0
        private void DragDrop_Mouse_Move(object sender, MouseEventArgs e)
        {
            // The mouse button is pressed
            if (m_dragdropMouseLocation != Point.Empty)
            {
                //System.Diagnostics.Debug.Write("Move" + e.X + "," + e.Y + "\r\n");

                // The mouse has moved!
                if (Math.Abs(m_dragdropMouseLocation.X - e.X) > 3 || Math.Abs(m_dragdropMouseLocation.Y - e.Y) > 3)
                {
                    //System.Diagnostics.Debug.Write("Move1 " + e.X + "," + e.Y + "\r\n");

                    if (GridDragStart != null)
                    {
                        //Point p = (sender as Xceed.Grid.Cell).ClientPointToGrid(new Point(e.X, e.Y));

                        GridDataGragEventArgs e2 = new GridDataGragEventArgs();
                        GridDragStart(sender, e2);

                        //m_dragDropDataFormats = e2.Data.GetFormats();

                        //// Create our DataObject that will contain the data (rows/cells) to drag.
                        //DataObject data = new DataObject(this.CreateDataObject());

                        // Initialize the drag/drop operation.
                        if (e2.Data != null && e2.AllowedEffect != DragDropEffects.None)
                        {
                            this.DoDragDrop(e2.Data, e2.AllowedEffect);
                        }
                    }

                    // Reset the location of the mouse.
                    m_dragdropMouseLocation = Point.Empty;
                }
            }
        }
        internal static void 专家调度一级动态优化_GridDragStart(object sender, GridDataGragEventArgs e)
        {
            e.Data = null;
            e.AllowedEffect = DragDropEffects.None;

            Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell;
            if (srcCell == null)
                return;

            if (srcCell.GridControl.Name.Contains("top"))
            {
                if (srcCell.ParentColumn.FieldName == m_topGridDragFildeName
                    && srcCell.Value != null
                    && srcCell.ParentRow.Cells["新任务号"].Value == null)
                {
                    e.Data = new DataObject(m_dragDataFormatDelete, srcCell);
                    e.AllowedEffect = DragDropEffects.Move;
                }
            }
            if (srcCell.GridControl.Name.Contains("bottom"))
            {
                if (srcCell.ParentRow.ForeColor != 专家调度一级静态优化.优化DisableColor)
                {
                    e.Data = new DataObject(m_dragDataFormatAdd, srcCell);
                    e.AllowedEffect = DragDropEffects.Link;
                }
            }
        }
        void 车队调度静态任务下达_GridDragStart(object sender, GridDataGragEventArgs e)
        {
            e.Data = null;
            e.AllowedEffect = DragDropEffects.None;

            Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell;
            if (srcCell == null)
                return;

            if (srcCell.GridControl == m_待命车辆_单车多任务Grid)
            {
                // Todo
                if (srcCell.ParentColumn.FieldName.StartsWith(m_topGridDragFildeName)
                    && srcCell.Value != null
                    && srcCell.ParentRow.Cells["作业号Any"].Value == null)
                {
                    e.Data = new DataObject(m_dragDataFormatDelete, srcCell);
                    e.AllowedEffect = DragDropEffects.Move;
                }
            }
            else if (srcCell.GridControl == m_待排任务Grid)
            {
                if (srcCell.ParentRow.ForeColor != 专家调度一级静态优化.优化DisableColor)
                {
                    e.Data = new DataObject(m_dragDataFormatAdd, srcCell);
                    e.AllowedEffect = DragDropEffects.Link;
                }
            }
        }
Ejemplo n.º 4
0
        void m_待排转关箱任务区Grid_GridDragStart(object sender, GridDataGragEventArgs e)
        {
            e.Data = null;
            e.AllowedEffect = System.Windows.Forms.DragDropEffects.None;

            转关箱排车暂存组 entity = m_暂存计划区Grid.DisplayManager.CurrentItem as 转关箱排车暂存组;
            if (entity == null)
            {
                return;
            }

            Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell;
            if (srcCell == null)
                return;

            if (srcCell.GridControl == m_待排转关箱任务区Grid
                && srcCell.ParentColumn.FieldName == m_topGridDragFildeName
                && srcCell.ParentRow.Cells[m_topGridDragFildeName].Value != null)
            {
                string s = srcCell.ParentRow.Cells[m_topGridDragFildeName].Value.ToString();
                string[] ss = s.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                int? cnt = ConvertHelper.ToInt(ss[1]);
                if (cnt.HasValue && cnt.Value > 0)
                {
                    e.Data = new System.Windows.Forms.DataObject(m_dragDataFormatAdd, srcCell);
                    e.AllowedEffect = System.Windows.Forms.DragDropEffects.Link;
                }
                return;
            }
            if (srcCell.GridControl == m_全部监管车辆及作业现状Grid
                && srcCell.Value != null)
            {
                e.Data = new System.Windows.Forms.DataObject(m_dragDataFormatDelete, srcCell);
                e.AllowedEffect = System.Windows.Forms.DragDropEffects.Move;
                return;
            }
        }