您的位置:首页 > 编程语言

TX Text Control拖拽文件的示例代码

2013-10-31 13:24 176 查看
用以下代码,实现和微软Word一样的拖放功能,直接将图像、文本等文件通过鼠标拖拽的方式,放置入文档的当前输入位置。

private void textControl1_DragDrop(object sender, DragEventArgs e)

{

Point posCursor = textControl1.PointToClient(new Point(e.X, e.Y));

TXTextControl.TextChar txChar =

textControl1.TextChars.GetItem(posCursor, true);

textControl1.Selection.Start = txChar.Number;

textControl1.Selection.Load(fileDragDrop.FileName,

fileDragDrop.StreamType);

}


注意TextChars.GetItem和Selection
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: