DragDrop, DragOver and TableControlMouseDown
Hi
how to do to insert into textBox1 or textBox2
the name of the column header gridGroupingControl1.
Attachment: test_ggc007_4b26763d.rar
how to do to insert into textBox1 or textBox2
the name of the column header gridGroupingControl1.
After dragging the right mouse button to the appropriate textBox1 or textBox2
Attachment: test_ggc007_4b26763d.rar
SIGN IN To post a reply.
3 Replies
JP
Jagadeesan Pichaimuthu
Syncfusion Team
July 9, 2019 06:28 AM UTC
Hi Gregory,
Thanks for using Syncfusion product.
To drag and drop the column header text, you could handle the TableControlMouseDown event. Please refer the following code example and the modified sample.
C#
|
this.gridGroupingControl1.TableControlMouseDown += gridGroupingControl1_TableControlMouseDown;
void gridGroupingControl1_TableControlMouseDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlMouseEventArgs e)
{
GridGroupingControl grid = sender as GridGroupingControl;
if (grid != null)
{
GridTableControl tableControl = grid.TableControl;
Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor columnDescriptor = gridGroupingControl1.TableControl.GetHeaderColumnDescriptorAt(e.Inner.Location);
if (columnDescriptor != null)
{
rightClickCol = columnDescriptor.HeaderText;
DragDropEffects ef = tableControl.DoDragDrop(rightClickCol, DragDropEffects.Copy);
}
}
}
textBox.AllowDrop = true;
textBox.DragDrop += TextBox1_DragDrop;
textBox.DragEnter += TextBox1_DragEnter;
private void TextBox1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.Text)) e.Effect = DragDropEffects.Copy;
}
private void TextBox1_DragDrop(object sender, DragEventArgs e)
{
var data = e.Data.GetData(DataFormats.Text);
if(data != null)
{
(sender as TextBox).Text = data.ToString();
}
} |
Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/test_ggc007625500763
Please get back to us if you need any further assistance on this.
Regards,
JagadeesanHi Gregory,Thanks for using Syncfusion product.To drag and drop the column header text, you could handle the TableControlMouseDown event. Please refer the following code example and the modified sample.C#
this.gridGroupingControl1.TableControlMouseDown += gridGroupingControl1_TableControlMouseDown;void gridGroupingControl1_TableControlMouseDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlMouseEventArgs e){GridGroupingControl grid = sender as GridGroupingControl;if (grid != null){GridTableControl tableControl = grid.TableControl;Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor columnDescriptor = gridGroupingControl1.TableControl.GetHeaderColumnDescriptorAt(e.Inner.Location);if (columnDescriptor != null){rightClickCol = columnDescriptor.HeaderText;DragDropEffects ef = tableControl.DoDragDrop(rightClickCol, DragDropEffects.Copy);}}}textBox.AllowDrop = true;textBox.DragDrop += TextBox1_DragDrop;textBox.DragEnter += TextBox1_DragEnter;private void TextBox1_DragEnter(object sender, DragEventArgs e){if (e.Data.GetDataPresent(DataFormats.Text)) e.Effect = DragDropEffects.Copy;}private void TextBox1_DragDrop(object sender, DragEventArgs e){var data = e.Data.GetData(DataFormats.Text);if(data != null){(sender as TextBox).Text = data.ToString();}}Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/test_ggc007625500763Please get back to us if you need any further assistance on this.Regards,Jagadeesan
Hi Jagadeesan
thank you for the quick reply
Regards,
Gregory
JP
Jagadeesan Pichaimuthu
Syncfusion Team
July 9, 2019 07:16 AM UTC
Hi Gregory,
Thanks for your update.
Please let us know if you have any further queries on this. We are happy to help you.
Regards,
Jagadeesan
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
GP Gregory Pe
- Jul 8, 2019 07:43 PM UTC
- Jul 9, 2019 07:16 AM UTC