Events and Drag-Drop

  • Hi,
    I have searched the forum and documentation, but I don't sem to be able to find any information on mouse events and drag-drop.

    Are standard mouse events such as MouseEnter fired?
    Are drag/drop events such as OnDragDrop fired ?

    VS.net (2005) lets me add handlers for them in the GUI, but then when I try to view the form (actually a user control in this case) in VS.Net, it pukes with an error saying "The type 'WPDynamic.WPDLLInt' has no event named 'MouseEnter'" This certainly appears to be accurate since I cant find the event in the object browser or Reflector. When I use AddHandler the target method never fires.

    If these events aren't fired (especially the drag drop) are there any known workarounds? I could always trap the event manually by using non-CLR/PInvoke code, but that seems like a pain

    Thanks,
    Chris Moses

    • Offizieller Beitrag

    Hi,

    the following standard events are not available

    They are removed using a ControlDesigner - I wonder why VS2005 displayes them.

    The following mouse events are published instead:

    OnMouseMove
    OnMouseDown
    OnMouseUp
    OnDoubleClick

    they receive a MouseEventArgs which can be casted to wpMouseEventArgs. wpMouseEventArgs contains the additional property Editor (the number of the editor) and Shift, a bitfield for the shift state which was missing in the original MouseEventArgs.

    I wanted to implement .NET drag&drop but I haven't yet developed the concept fully.

    Julian Ziersch

    • Offizieller Beitrag

    Hi,

    I am a bit surprised. I had removed the drag events because I thought they were not ready, but using this example code dragging items from a string list into the editor works (adapted from an articel on codeproject)

    Dragging text from the editor to the listbox does not work ok since the internal drawg&drop support interferes (it is not possible to use MouseDown to start the Drag operation)

    Julian