GetCaretIndexFromPoint on SqlTextEditor
Hello,
is there any workaround to use GetCharIndexFromPosition and GetPositionFromCharIndex (WinForms Textbox has them) with the SqlTextEditor. I want to move the Caret while Dragging Something Over the SqlTextEditor:
private int GetCaretIndexFromPoint(TextBox box, int x, int y)
{
Point realPoint = box.PointToClient(new Point(x, y));
int index = box.GetCharIndexFromPosition(realPoint);
if (index == box.Text.Length - 1)
{
Point caretPoint = box.GetPositionFromCharIndex(index);
if (realPoint.X > caretPoint.X)
{
index += 1;
}
}
return index;
}
If i change the Parameter from TextBox to ActiveDatabaseSoftware.ExpressionEditor.SqlTextEditor the GetCharIndexFromPosition and GetPositionFromCharIndex are not implemented :(
Any Ideas?
best Regards
Manuel
You should handle the PreProcessDragOver and PreProcessDragDrop events of SqlTextEditor. Code sample is provided in the comment.