We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

REGD--Locating the current position

Hi There, I would like to drag(source) some text in Richtextbox and drop in the same Richtextbox but in some other location.How to find the cursor position(destination) while dropping.(i.e) where he is dropping that cursor position I want.Kindly someone help me out. Thanks in advance, Cheers, Manohar.

3 Replies

AD Administrator Syncfusion Team September 23, 2005 12:48 PM UTC

Hi Manohar, You could try this code snippet and see if this helps. private void gridControl1_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { Point pt = this.gridControl1.PointToClient(Control.MousePosition); int rowIndex, colIndex; this.gridControl1.PointToRowCol(pt, out rowIndex, out colIndex); Console.WriteLine("Drop Row"+rowIndex); Console.WriteLine("Drop col"+colIndex); } Here is the sample. RichTextDrop_3893.zip Let us know if this helps. Best Regards, Jeba.


MA manohar September 26, 2005 08:58 AM UTC

Hi Jeba, Actually you have misunderstood my requirement.I am using "GridDataBoundGrid" , in that one cell bahaves as RichTextCell(i.e., CellType is RichTextCell).Now the difficulty starts...remember everything happens in that cell only.For your info its multiline.First I will select some text,I will drag it,I will drop it somewhere in the same cell(remember same cell),now my question is how to know the destination point and in which event i need to write that. Note:Every word is important in this.In all other scenarios it''s working fine,that''s why i am telling like this. Thanks in advance, Regards, Manohar.


AD Administrator Syncfusion Team September 27, 2005 11:39 AM UTC

Hi Manohar, Drag and drop within the same Richtext cell is not supported, only copy and paste is supported out of the RichText box. The reason for this is that the Windows Forms RichTextBox does not support Drag and Drop, only copy paste. If you want this support, you could try to derive a custom cell type to support D&D. First you could try to get D&D working with a richtextbox sitting on a form. After that please try to implement that richtextbox in a grid cell. The richtextbox has methods that map a point to a char: rtb.GetCharFromPosition rtb.GetCharIndexFromPosition Regards, Jeba.

Loader.
Live Chat Icon For mobile
Up arrow icon