我用的是c#,现在想在textbox控件之间实现文本拖动,但是有个困难,如何先选择文本再进行拖动?
我的做法是
private void textBox1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
if (textBox1.SelectedText == "")
就是这边不会写 ;
else
textBox1.DoDragDrop(textBox1.SelectedText, DragDropEffects.Copy);
}
}上面的第一个分支不会写,各位有什么想法不?
我的做法是
private void textBox1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
if (textBox1.SelectedText == "")
就是这边不会写 ;
else
textBox1.DoDragDrop(textBox1.SelectedText, DragDropEffects.Copy);
}
}上面的第一个分支不会写,各位有什么想法不?
所以你要学习:
控件的AllowDrop以及相关方法,搜索:c# 拖拽 控件