private void mappedSignalAttributes_DragDrop( object sender, DragEventArgs e )
{
var dscreen = new Point( e.X, e.Y );
Point dclient = mappedSignalAttributes.PointToClient( dscreen );
DataGridView.HitTestInfo hit = mappedSignalAttributes.HitTest( dclient.X, dclient.Y );
if (hit.Type == DataGridViewHitTestType.Cell)
{
DataGridViewCell cell = mappedSignalAttributes.Rows[hit.RowIndex].Cells[hit.ColumnIndex];
var oldText = cell.Value as string;
var bean = mappedSignalAttributes.Rows[hit.RowIndex].DataBoundItem as SourceSignalAttributeMapBean;
if (bean != null)
{
string data = e.Data.GetData(DataFormats.Text).ToString();
string[] parts = data.Split('|');
bean.targetName = parts[1];
mappedSignalAttributes.InvalidateRow( hit.RowIndex );
mappedSignalAttributes.Update();
cell.Style.ForeColor = bean.targetName.Equals(oldText) ? Color.Black : Color.Blue;
}
}
}