Hi Michael,
Scrolling the record during the draganddrop process:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
To scroll the grid record during the drag and drop process, you need to handle the DragOver event of the grid and set the TableControl.TopRowIndex property. Below are the codes:
private void grid_DragOver(object sender, DragEventArgs e)
{
// showing the dragdrop effects.
if(e.Data.GetDataPresent(typeof(SelectedRecordsCollection)))
{
e.Effect = DragDropEffects.Copy;
}
Point pt = this.gridGroupingControl1.TableControl.PointToClient(Control.MousePosition);
int rowIndex, colIndex;
this.gridGroupingControl1.TableControl.PointToRowCol(pt, out rowIndex, out colIndex);
if (rowIndex == this.gridGroupingControl1.TableControl.TopRowIndex)
{
this.gridGroupingControl1.TableControl.TopRowIndex--;
}
else if ( rowIndex == this.gridGroupingControl1.TableControl.ViewLayout.LastVisibleRow )
this.gridGroupingControl1.TableControl.TopRowIndex++;
}
De-select the original record :
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Try calling the Table.SelectedRecords.Clear() method before calling the SetSelected() method in TableControl.MouseMove event. Below are the codes:
void TableControl_MouseMove(object sender, MouseEventArgs e)
{
GridTableControl tc = sender as GridTableControl;
if (IsLocked)
{
tc.CurrentCell.Unlock();
IsLocked = false;
tc.Table.SelectedRecords.Clear();
DragRecord.SetSelected(true);
}
}
Here is a sample for your reference.
ModifiedDragDrop_GGCSelectDragRow.zipBest regards,
Haneef