private void gridView_MouseDown(object sender, MouseEventArgs e) { BaseView view = gridView.GridControl.GetViewAt(e.Location); (view as GridView).GridControl.Cursor = Cursors.Default; BaseHitInfo baseHI = view.CalcHitInfo(e.Location); GridHitInfo gridHI = baseHI as GridHitInfo; if (gridHI.HitTest == GridHitTest.RowEdge) { sourceGridCell = null; lastMouseDownMoveCell = null; baseHI = view.CalcHitInfo(new Point(e.X, e.Y - 3)); gridHI = baseHI as GridHitInfo; if (gridHI.HitTest == GridHitTest.RowCell) { object val = (view as GridView).GetRowCellValue(gridHI.RowHandle, gridHI.Column); if (val == null || val.ToString() == string.Empty) { return; } sourceGridCell = new GridCell(gridHI.RowHandle, gridHI.Column); lastMouseDownMoveCell = new GridCell(sourceGridCell.RowHandle, sourceGridCell.Column); } } }
private void gridView_MouseMove(object sender, MouseEventArgs e) { BaseView view = gridView.GridControl.GetViewAt(e.Location); BaseHitInfo baseHI = view.CalcHitInfo(e.Location); GridHitInfo gridHI = baseHI as GridHitInfo; if (gridHI.HitTest == GridHitTest.RowCell && sourceGridCell != null) { bool is_changed = false; if (lastMouseDownMoveCell.RowHandle != gridHI.RowHandle || lastMouseDownMoveCell.Column.FieldName != gridHI.Column.FieldName) { is_changed = true; int rowHandle = lastMouseDownMoveCell.RowHandle; GridColumn gridCol = lastMouseDownMoveCell.Column; lastMouseDownMoveCell = new GridCell(gridHI.RowHandle, gridHI.Column); (view as GridView).InvalidateRowCell(rowHandle, gridCol); } if (is_changed) { (view as GridView).InvalidateRowCell(lastMouseDownMoveCell.RowHandle, lastMouseDownMoveCell.Column); } } else if (gridHI.HitTest == GridHitTest.RowEdge && sourceGridCell == null) { baseHI = view.CalcHitInfo(new Point(e.X, e.Y - 3)); gridHI = baseHI as GridHitInfo; if (gridHI.HitTest == GridHitTest.RowCell) { if (gridHI.RowHandle == (view as GridView).FocusedRowHandle && gridHI.Column == (view as GridView).FocusedColumn) { (view as GridView).GridControl.Cursor = Cursors.SizeAll; } } } else { (view as GridView).GridControl.Cursor = Cursors.Default; } }
//private void gridControl1_MouseMove( object sender, MouseEventArgs e ) //{ // GridControl grid = sender as GridControl; // if( grid == null ) // { // return; // } // // Get a View at the current point. // BaseView view = grid.GetViewAt( e.Location ); // // Retrieve information on the current View element. // BaseHitInfo baseHI = view.CalcHitInfo( e.Location ); // GridHitInfo gridHI = baseHI as GridHitInfo; // if( gridHI != null ) // { // Text = gridHI.HitTest.ToString( ); // } //} private void gridView1_MouseMove(object sender, MouseEventArgs e) { BaseView view = sender as BaseView; // Retrieve information on the current View element. BaseHitInfo baseHI = view.CalcHitInfo(e.Location); GridHitInfo gridHI = baseHI as GridHitInfo; if (gridHI != null) { Text = gridHI.HitTest.ToString( ); } }
private void MyGridControl_MouseUp(object sender, MouseEventArgs e) { // Get a View at the current point. BaseView View = GetViewAt(e.Location); // Retrieve information on the current View element. BaseHitInfo baseHI = View.CalcHitInfo(e.Location); GridHitInfo gridHI = baseHI as GridHitInfo; //Perform any necessary logic if (gridHI.InRow == true && gridHI.InRowCell == false && e.Button == MouseButtons.Right) { GridViewColumnButtonMenu Menu = new GridViewColumnButtonMenu(View as GridView); Menu.SubMenuItems = SubMenuItems; Menu.OnMyClick += new GridViewColumnButtonMenu.OnMyClickEventHandler(Menu_OnMyClick); Menu.Init(gridHI); Menu.Show(gridHI.HitPoint); } }
private void gridControl1_MouseMove(object sender, MouseEventArgs e) { GridControl grid = sender as GridControl; if (grid == null) { return; } // Get a View at the current point. BaseView view = grid.GetViewAt(e.Location); // Retrieve information on the current View element. BaseHitInfo baseHI = view.CalcHitInfo(e.Location); GridHitInfo gridHI = baseHI as GridHitInfo; if (gridHI != null) { Text = gridHI.HitTest.ToString( ); } }