in Education by
I'm maintaining a Windows app that has multiple forms in the one window (form1, form2, form3). I'm treating the other form2 and form3 as black boxes at the moment. In form1 I have a TreeView, and I'm implementing drag and drop functionality within that TreeView. How can I prevent a drop outside of the form1 control? I'm implementing 3 events handlers: private void treeView_ItemDrag (...) { DoDragDrop(e.Item, DragDropEffects.Move); } private void treeView_DragEvent (...) { e.Effect = DragDropEffects.Move; } private void treeView_DragDrop (...) { //the node move logic here } form2 and form3 have a drag and drop relationship between them, so when I drag a node from form1 into form3 by default it allows the move (bad). I want to be able to prevent this from the form1 control code. How can I prevent a drop outside of the form1 control? I've looked at the _DragLeave event, but I'm unsure how to control the operation without the DragEventArgs. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
There is this little know property in the Cursor object that can restrict the mouse movement only to a certain rectangle. this as a global variable for Form1 Rectangle _originalClip; this goes in your Form1_Load event _originalClip = Cursor.Clip; this could be in your treeView.ItemDrag, forcing the cursor inside the form1 client area Cursor.Clip = form1.RectangleToScreen(form1.ClientRectangle); Now you need to restore the original clip area. A good place will be in the treeView.DragDrop. But to be on the safe side put also in your Form1_Closing event Cursor.Clip = _originalClip;

Related questions

0 votes
    How to get the container TreeView of a TreeNode ?? Thank you all. JavaScript questions and answers, ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    To open the table, on the icon that has the required table name in Tables Pane of Database Window (A) Drag ... click (D) Triple Click Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    Which of the following are the drag and drop events? (a) drop (b) dragstart (c) both drop and ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 22, 2021 in Education by JackTerrance
0 votes
    How can I use Ext.tree.ViewDDPlugin's events? I have a TreePanel that uses DDPplugin, but I'd ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 17, 2022 in Education by JackTerrance
0 votes
    The voltage drop across a standard resistor of 0.2 Ω is balanced at 83 cm. The magnitude of the current, if ... for GATE EC Exam, Network Theory MCQ (Multiple Choice Questions)...
asked Oct 17, 2021 in Education by JackTerrance
0 votes
    I have a treeview and based on items of treeview i have listview on right side. SO almost UI is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    I am trying to figure out a way to use the StringFormat class to add new line to a given TreeNode ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    Having a problem getting a TreeView control to display node images. The code below works sometimes but fails ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I am trying to add some items to a TreeView Control: TV1.Nodes.Add("key1", "Test1") 'Works TV1. ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 28, 2022 in Education by JackTerrance
0 votes
    In CCVS, voltage depends on the control current and the constant called __________ (a) Transconductance (b) ... EC Exam, Network Theory MCQ (Multiple Choice Questions)...
asked Oct 20, 2021 in Education by JackTerrance
0 votes
    In CCVS, voltage depends on the control current and the constant called __________ (a) Transconductance (b) ... section Circuit Elements and Kirchhoff's Laws of Network Theory...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    Which is the current version of ASP.NET AJAX Control Toolkit?...
asked Dec 31, 2020 in Technology by JackTerrance
0 votes
    c. To copy a formula in Microsoft Excel, you select the cell and drag this symbol that appears on the lower ... 7 computer please help Select the correct answer from above options...
asked Dec 28, 2021 in Education by JackTerrance
0 votes
    To copy a formula in Microsoft Excel, you select the cell and drag this ___ write one word Select the correct answer from above options...
asked Dec 27, 2021 in Education by JackTerrance
...