c# - How can I save definitely the new location of a TableLayoutPanel after a drag and drop in a panel? -
i'm trying drag , drop tablelayoutpanel in panel using winforms/c#, drag , drop of tablelayoutpanel works how can save new location of tablelayoutpanel using button action ? solution please ?
private void registration_load(object sender, eventargs e) { panel2.allowdrop = true; tablelayoutpanel1.allowdrop = true; panel2.dragenter += panel2_dragenter; panel2.dragdrop += panel2_dragdrop; tablelayoutpanel1.mousedown += tablelayoutpanel1_mousedown; } private void panel2_dragenter(object sender, drageventargs e) { if (e.data.getdatapresent(typeof(tablelayoutpanel))) e.effect = dragdropeffects.move; } private void panel2_dragdrop(object sender, drageventargs e) { var tlp = (tablelayoutpanel)e.data.getdata(typeof(tablelayoutpanel)); tlp.location = panel2.pointtoclient(new point(e.x, e.y)); tlp.parent = panel2; tlp.bringtofront(); } private void tablelayoutpanel1_mousedown(object sender, mouseeventargs e) { tablelayoutpanel1.dodragdrop(tablelayoutpanel1, dragdropeffects.move); }
i find solution problem. idea save location of items in database (location.x a,d location.y) in load page fix location of dropped item location saved in database.
Comments
Post a Comment