static public int GetPositionFromMouseLocation(this ScintillaGateway document) { Point point = Cursor.Position; ScreenToClient(document.Handle, ref point); int pos = document.CharPositionFromPointClose(point.X, point.Y); return(pos); }