c# - DoDragDrop from standard Label not working -
c# - DoDragDrop from standard Label not working -
i can't figure out why attempting drag text standard label notepad (or other command accepting text) doesn't work. i've looked @ documentation , examples , i'm not seeing problem. cursor remains circle line through , if register feedback callback event none. creating standard windows forms application, dropping label command , registering mousedown & mousemove events have code phone call label1.dodragdrop (label1, dragdropeffects.all | dragdropeffects.link). help appreciated.
here 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; } } } } }
standard edit controls (textboxes) not back upwards drag&drop , not take dropped text.
c# drag-and-drop label
Comments
Post a Comment