Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
16088 | Jul 6,2004 08:44 AM UTC | Jul 13,2016 05:54 AM UTC | WinForms | 26 |
![]() |
Tags: GridControl |
if(this.gridDataBoundGrid1.Selections.Ranges.ActiveRange.IsEmpty) { this.gridDataBoundGrid1.CurrentCell.EndEdit(); this.gridDataBoundGrid1.Selections.Add(this.gridDataBoundGrid1.CurrentCell.RangeInfo); }
>if(this.gridDataBoundGrid1.Selections.Ranges.ActiveRange.IsEmpty) >{ this.gridDataBoundGrid1.CurrentCell.EndEdit(); > this.gridDataBoundGrid1.Selections.Add(this.gridDataBoundGrid1.CurrentCell.RangeInfo); >} >
Private Sub Model_ClipboardCanPaste(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCutPasteEventArgs)
Dim dataObject As IDataObject = Clipboard.GetDataObject()
If dataObject IsNot Nothing Then
Dim s As String = CType(dataObject.GetData(DataFormats.Text), String)
Dim copran As GridRangeInfo = Me.GridControl1.Selections.Ranges.ActiveRange
For i As Integer = copran.Top To copran.Bottom
For j As Integer = copran.Left To copran.Right
Me.GridControl1.Model(i, j).FormattedText = s
Next j
Next i
End If
e.Handled = True
e.Result = False
End Sub
Private Sub Model_ClipboardCanPaste(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCutPasteEventArgs)
Dim dataObject As IDataObject = Clipboard.GetDataObject()
If dataObject IsNot Nothing Then
Dim s As String = CType(dataObject.GetData(DataFormats.Text), String)
For Each copran As GridRangeInfo In Me.GridControl1.Selections.Ranges
For i As Integer = copran.Top To copran.Bottom
For j As Integer = copran.Left To copran.Right
Me.GridControl1.Model(i, j).FormattedText = s
Next j
Next i
Next
End If
e.Handled = True
e.Result = False
End Sub
this.gridControl1.Model.ClipboardCanPaste += new GridCutPasteEventHandler(Model_ClipboardCanPaste);
// It is used to capture after paste for single cell
this.gridControl1.Model.CellsChanged += new GridCellsChangedEventHandler(Model_CellsChanged);
// It is used to capture after paste for Multiple cell
this.gridControl1.CurrentCellChanged += new EventHandler(gridControl1_CurrentCellChanged);
bool pasted = false;
void Model_ClipboardCanPaste(object sender, GridCutPasteEventArgs e)
{
// To intimate the paste operation
pasted = true;
}
void gridControl1_CurrentCellChanged(object sender, EventArgs e)
{
if (pasted)
{
pasted = false;
MessageBox.Show("Pasted");
}
}
void Model_CellsChanged(object sender, GridCellsChangedEventArgs e)
{
if (pasted)
{
pasted = false;
MessageBox.Show("Pasted");
}
}
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.