I am using the following code below to copy from 1 grid cell and paste into many cell in the same column. I am using a virtual grid.
It works but the issue is that
1. After the data gets pasted, (while the grid has the whole column highlighted) i can''t move the cursor right or left for a number of seconds.
2. When i finally can move the cursor, it seems the cell painting gets screwed up because half the cell still shows the color as if it was still highlighted which the rest of cell displays normally. I have attached a picture to show you what i mean.
Any thoughts on each of these items.
thks,
ak
private void Model_ClipboardPaste(object sender, GridCutPasteEventArgs e)
{
DataObject obj = Clipboard.GetDataObject() as DataObject;
string data = obj.GetData(typeof (string)).ToString();
GridRangeInfo info = _HPGrid.Model.SelectedRanges.ActiveRange;
string[] cells = data.Split(new char[] {''\t''});
for (int i = info.Top; i <= info.Bottom; i++)
{
int cellsCount = 0;
for (int j = info.Left; j <= info.Right; j++)
{
_HPGrid.Model[i, j].Text = cells[cellsCount];
cellsCount++;
}
}
}
gridScreenShot.zip