开发者

Drag-and-drop event override C# GUI

开发者 https://www.devze.com 2023-01-17 14:36 出处:网络
I have a drag-and-drop event handler registered to a parent form, this.DragDrop += new DragEventHandler(Form_DragDrop);

I have a drag-and-drop event handler registered to a parent form,

this.DragDrop += new DragEventHandler(Form_DragDrop);

There are several child form that are derived from the parent form. However, when I drag an item inside the forms, the action is only valid if there are no other components in 开发者_如何学Gothat area.

I would like the drag-and-drop action to be valid in ALL areas of the form, including buttons, textboxes, etc. Is there anyway to specify some sort of overriding behavior inside the parents form?


You will have to implement the D+D events on all the controls. Not exactly practical, but you could do so by iterating the Form.Controls collection recursively. Give the user a good drop target, makes it easier for her to guess where to drop, easier for you to implement the code.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号