Skip to main content

Drag & Drop

Comments

4 comments

  • Dapfor Team

    Hi,

    Here is a code demonstrating how to get X, Y location and key state in the DragContentEventArgs object:

                Point point = e.TargetGrid.PointToClient(Cursor.Position);
                Keys keys = Control.ModifierKeys;

    But you are right, we don't call base.OnDragDrop() in grid's overridden methods. We will fix it and also provide properties to get X, Y, and KeyState in the DragContentEventArgs  class.

    Therefore the DragContentEventArgs object provides target grid, target row and also position where the data is inserted. Moreover in the e.Data property you can find IDataObject which provides clipboard information with available clipboard formats.

    Best regards,

    0
  • Sten Kothe

    I tried to use the DragEnterContent and DragDropContent, but it doesnt work for me. I just want to drop some data into the grid, but the DragDropEffects are always "None" and the DragDropContent event is not fired.

    I attach a sample project of my problem.

     




    WindowsFormsApplication1.zip
    0
  • Dapfor Team

    Hi Sten,

    You get the 'None' effect because you don't handle m_Grid.DragOverContent event. Just add

    this.m_Grid.DragOverContent += new EventHandler<DragContentEventArgs>(MyDragEnterContent);

    and your example will work. In attachments you will find a fixed example.

    Regards,

    The Dapfor Team




    WindowsFormsApplication1.zip
    0
  • Sten Kothe

    Thanks! very good support!

    0

Please sign in to leave a comment.

Powered by Zendesk