The turntable is a common operation in the catering system. Generally, right-click the system to pop up the target platform interface, and select the target platform, now we can drag the platform to be switched to the target icon to achieve the previous operation, which is simple and quick.
During turntable operation:
After the turntable is successful:
/// <Summary> /// triggered when a certain item is dragged /// </Summary> /// <Param name = "sender"> </param> /// <Param name = "E"> </param> private void listview1_itemdrag (Object sender, itemdrageventargs e) {listview1.dodragdrop (E. item, dragdropeffects. move );} /// <summary> /// drag an item to the control area /// </Summary> /// <Param name = "sender"> </param> /// <Param name = "E"> </param> private void listviewincludragenter (Object sender, drageventargs E) {e. effect = dragdropeffects. move ;} /// <summary> /// when dragging an item to the top of a row, /// </Summary> /// <Param name = "sender"> </Param >/// <Param name = "E"> </param> private void listviewdomaindragover (Object sender, drageventargs e) {point ptscreen = new point (e. x, E. y); point Pt = listview1.pointtoclient (ptscreen); listviewitem item = listview1.getitemat (pt. x, PT. y); If (item! = NULL) item. selected = true ;} /// <summary> /// end dragging /// </Summary> /// <Param name = "sender"> </param> /// <Param name = "E"> </param> private void listviewincludragdrop (Object sender, drageventargs e) {listviewitem draggeditem = (listviewitem) E. data. getdata (typeof (listviewitem); // The old destination point ptscreen = new point (e. x, E. y); point Pt = listview1.pointtoclient (ptscreen); listviewitem targetitem = listview1.getitemat (pt. x, PT. y); // new target if (null = targetitem) {return;} If (messageboxex. show ("[" + draggeditem. text + "] Go to [" + targetitem. text + "]", "Ask", messageboxbuttons. okcancel, messageboxicon. question) = dialogresult. OK) {var item = draggeditem. tag as view_tablelistmodel; int tableid = item. ID;} // listview1.items. insert (targetitem. index, (listviewitem) draggeditem. clone (); // listview1.items. remove (draggeditem );}
C # Drag and Drop Operations