private void myGridView2_DragObjectDrop(object sender, DevExpress.XtraGrid.Views.Base.DragObjectDropEventArgs e)
 {
     if (e.DropInfo.Valid && !e.Canceled && e.DragObject is GridColumn && ((GridColumn)e.DragObject).View != sender)
     {
         (sender as GridView).BeginUpdate();
         try
         {
             GridColumn sourceCol = e.DragObject as GridColumn;
             GridColumn column    = (sender as GridView).Columns.ColumnByFieldName(sourceCol.FieldName);
             if (column == null)
             {
                 column = (sender as GridView).Columns.AddField(sourceCol.FieldName);
             }
             if (((ColumnPositionInfo)e.DropInfo).InGroupPanel)
             {
                 column.Group();
                 column.GroupIndex = e.DropInfo.Index;
             }
             else
             {
                 column.VisibleIndex = e.DropInfo.Index;
             }
         }
         finally
         {
             (sender as GridView).EndDataUpdate();
         }
     }
 }
Beispiel #2
0
 private void gridView1_DragObjectDrop(object sender, DevExpress.XtraGrid.Views.Base.DragObjectDropEventArgs e)
 {
     if (this.DataChart.CalcHitInfo(this.DataChart.PointToClient(MousePosition)).InDiagram)
     {
         var col = (e.DragObject as DevExpress.XtraGrid.Columns.GridColumn);
         if (this.repositoryItemComboBox2.Items.Contains(col.FieldName))
         {
             this.barEditItem1.EditValue = col.FieldName;
         }
     }
 }
Beispiel #3
0
        private void gridView1_DragObjectDrop(object sender, DevExpress.XtraGrid.Views.Base.DragObjectDropEventArgs e)
        {
            MonitorSeriesData data = null;
            List <IDrawBoard <DevExpress.XtraCharts.ChartControl> > DrawBoards = null;

            try
            {
                var col = (e.DragObject as DevExpress.XtraGrid.Columns.GridColumn);
                if (col.FieldName != this.ChooseColumnName && this.Data.Columns[col.FieldName].DataType != typeof(string) && this.Data.Columns[col.FieldName].DataType != typeof(DateTime))
                {
                    var    mouseposition = this.listBoxControl1.PointToClient(MousePosition);
                    int    grouptype     = Convert.ToInt32(this.txtGroupType.EditValue);
                    string spectrumwith  = this.pupFreqWidth.Text.Trim() == "" ? "0" : this.pupFreqWidth.Text.Trim();
                    if (this.cmbGroupType.SelectedIndex == 1)
                    {
                        if (this.gridView1.GroupCount < 1)
                        {
                            throw new Exception("Group模式下请先对数据进行分组");
                        }
                        grouptype = 0;
                    }
                    if (mouseposition.X > 0 && mouseposition.X < this.listBoxControl1.Width && mouseposition.Y > 0 && mouseposition.Y < this.listBoxControl1.Height)
                    {
                        data = new MonitorSeriesData(this.gridView1, col.FieldName, grouptype, spectrumwith, this.Colors[historySeriesCount++ % MaxSeriesCount].Color, DrawBoards = this.AddDrawBoards());
                        this.AddListItem(data);
                    }
                    else if (this.xtraTabControl1.CalcHitInfo(this.xtraTabControl1.PointToClient(MousePosition)).HitTest == DevExpress.XtraTab.ViewInfo.XtraTabHitTest.PageClient && this.xtraTabControl1.SelectedTabPage.Controls.Count >= 0)
                    {
                        var targetlayout = this.xtraTabControl1.SelectedTabPage.Controls[0];
                        int index        = targetlayout.Controls.IndexOf(targetlayout.GetChildAtPoint(targetlayout.PointToClient(MousePosition)));
                        if (index >= 0)
                        {
                            data = new MonitorSeriesData(this.gridView1, col.FieldName, grouptype, spectrumwith, this.Colors[historySeriesCount++ % MaxSeriesCount].Color, DrawBoards = this.GetDrawBoards(index));
                            this.AddListItem(data);
                        }
                        else
                        {
                            data = new MonitorSeriesData(this.gridView1, col.FieldName, grouptype, spectrumwith, this.Colors[historySeriesCount++ % MaxSeriesCount].Color, DrawBoards = this.AddDrawBoards());
                            this.AddListItem(data);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                RemoveListItem(data);
            }
        }
Beispiel #4
0
        private void gridView1_DragObjectDrop(object sender, DevExpress.XtraGrid.Views.Base.DragObjectDropEventArgs e)
        {
            SPCDetermineData data = null;
            List <IDrawBoard <DevExpress.XtraCharts.ChartControl> > DrawBoards = null;

            try
            {
                var col = (e.DragObject as DevExpress.XtraGrid.Columns.GridColumn);
                if (col.FieldName != this.ChooseColumnName && this.Data.Columns[col.FieldName].DataType != typeof(string) && this.Data.Columns[col.FieldName].DataType != typeof(DateTime))
                {
                    var mouseposition = this.listBoxControl1.PointToClient(MousePosition);
                    var commands      = this.getSeletedCommands();
                    if (this.txtUpT.Text == "" || this.txtDownT.Text == "" || txtStandard.Text == "" || commands.Count < 1)
                    {
                        throw new Exception("条件输入不完整");
                    }
                    if (mouseposition.X > 0 && mouseposition.X < this.listBoxControl1.Width && mouseposition.Y > 0 && mouseposition.Y < this.listBoxControl1.Height)
                    {
                        data = new SPCDetermineData(this.gridView1, col.FieldName, Convert.ToDouble(this.txtUpT.Text), Convert.ToDouble(this.txtDownT.Text), Convert.ToDouble(this.txtStandard.Text), commands, this.Colors[historySeriesCount++ % MaxSeriesCount].Color, DrawBoards = this.AddDrawBoards());
                        this.AddListItem(data);
                    }
                    else if (this.xtraTabControl1.CalcHitInfo(this.xtraTabControl1.PointToClient(MousePosition)).HitTest == DevExpress.XtraTab.ViewInfo.XtraTabHitTest.PageClient && this.xtraTabControl1.SelectedTabPage.Controls.Count >= 0)
                    {
                        var targetlayout = this.xtraTabControl1.SelectedTabPage.Controls[0];
                        int index        = targetlayout.Controls.IndexOf(targetlayout.GetChildAtPoint(targetlayout.PointToClient(MousePosition)));
                        if (index >= 0)
                        {
                            data = new SPCDetermineData(this.gridView1, col.FieldName, Convert.ToDouble(this.txtUpT.Text), Convert.ToDouble(this.txtDownT.Text), Convert.ToDouble(this.txtStandard.Text), commands, this.Colors[historySeriesCount++ % MaxSeriesCount].Color, DrawBoards = this.GetDrawBoards(index));
                            this.AddListItem(data);
                        }
                        else
                        {
                            data = new SPCDetermineData(this.gridView1, col.FieldName, Convert.ToDouble(this.txtUpT.Text), Convert.ToDouble(this.txtDownT.Text), Convert.ToDouble(this.txtStandard.Text), commands, this.Colors[historySeriesCount++ % MaxSeriesCount].Color, DrawBoards = this.AddDrawBoards());
                            this.AddListItem(data);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                RemoveListItem(data);
            }
        }
        void OnDragObjectDrop(object sender, DevExpress.XtraGrid.Views.Base.DragObjectDropEventArgs e)
        {
            GridColumn column = e.DragObject as GridColumn;

            if (!CanDrag(column, e.DropInfo.Valid))
            {
                return;
            }
            if (e.DropInfo.Index < 0)
            {
                HideDragColumns();
            }
            else
            {
                MoveDragColumns(column.VisibleIndex - visibleIndex, column);
            }
            UpdateDragRectangle(true);
            UpdateDragColumns(true);
        }
        private void gridView1_DragObjectDrop(object sender, DevExpress.XtraGrid.Views.Base.DragObjectDropEventArgs e)
        {
            var column = e.DragObject as GridColumn;

            if (column == null)
            {
                return;
            }
            var gridView = sender as GridView;
            var hi       = gridView.CalcHitInfo(gridView.GridControl.PointToClient(Cursor.Position));

            if (hi.HitTest != GridHitTest.None && hi.HitTest != GridHitTest.Column)
            {
                column.Visible = false;
                return;
            }
            BeginInvoke(new MethodInvoker(() => {
                DoDragDrop(column.FieldName.ToString(), DragDropEffects.All);
            }));
        }
 private void gridView1_DragObjectDrop(object sender, DevExpress.XtraGrid.Views.Base.DragObjectDropEventArgs e)
 {
 }
Beispiel #8
0
 private void wgrDragDopEnd(object sender, DevExpress.XtraGrid.Views.Base.DragObjectDropEventArgs e)
 {
     int i = e.DropInfo.Index;
 }