I can't figure out why attempting to drag text from a standard Label to Notepad (or any other control accepting text) doesn't work. I've looked at documentation and examples and I'm not seeing the problem. The cursor remains a circle with a line through it and if I register a FeedBack callback the event is always NONE. Creating a standard Windows Forms Application, dropping a Label control and registering MouseDown & MouseMove events I have this code where I call label1.DoDragDrop (label1, DragDropEffects.All | DragDropEffects.Link). Any help would be appreciated.
Here is my form code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DragDropLabel
{
public partial class Form1 : Form
{
Point m_ClickLocation;
bool _bDragging = false;
public Form1()
{
InitializeComponent();
}
private void OnLabelMouseDown(object sender, MouseEventArgs e)
{
m_ClickLocation = e.Location;
_bDragging = true;
}
private void OnLabelMouseMove(object sender, MouseEventArgs e)
{
if (_bDragging)
{
Point pt = e.Location;
Size dragSize = SystemInformation.DragSize;
if (Math.Abs(pt.X - m_ClickLocation.X) > dragSize.Width / 2 ||
Math.Abs(pt.Y - m_ClickLocation.Y) > dragSize.Height / 2)
{
DragDropEffects rc = label1.DoDragDrop(label1, DragDropEffects.All | DragDropEffects.Link);
_bDragging = false;
}
}
}
}
}