Link to home
Start Free TrialLog in
Avatar of virtualmenon
virtualmenon

asked on

Table Layout Panel - Drag and Drop effects for a child control

I am working with the Table Layout Panel in Visual C#.net. I have a panel control which is inside one of the cells inside the table layout panel. My intention is to perform drag and drop of this panel control from one cell to other. I have achieved the drag and drop functionality.  However instead of having the traditional drag and drop effects including copy, move etc. I want the control to be visible while dragging rather than one of the effects. Really appreciate if any of you can help.

Thanking in advance,

CPM
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Couldn't you use the code I provided before?
https://www.experts-exchange.com/questions/24978681/Table-Layout-Panel-Dragging-and-droppping-a-control-from-one-cell-to-the-other.html

...and in the DragOver() event just move the control so it jumps around DURING the drag?
Avatar of virtualmenon
virtualmenon

ASKER

Hello Idle mind,

I had tried that but one problem i am facing is that my whole table layout panel flickers till the time I drop the control. So i thought may be i need to do something else. Do you have any idea what may be causing this.
Once again thanks a lot for your help.

Thanks,

CPM
This is what am doing in the drag_over event of the table layout panel.


        private void tp3_DragOver(object sender, DragEventArgs e)
        {
            Point p2 = tp3.PointToClient(new Point(x, y));
            Control c = tp3.GetChildAtPoint(p2);
           
            Point w = new Point();

            w.X = c.Location.X + (e.X - x);
            w.Y = c.Location.Y + (e.Y - y);

            c.Location = w;
           
        }

When i execute the code table layoutpanel seems to be getting into some loop, giving the flickering effect.

Thanks,

CPM
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks mate.