drag and drop - vb.net
I am implementing Drag & Drop in windows application. I have
- Main Form (Has a toolbar with Search, 开发者_如何学GoOpen, Print etc) - MdiContainer
- On Search - Open a child - Search form.
- Drag and Drop a file to a Grid on this search form.
- In DragDrop event of the Grid - Call a Modal form.
I am having trouble here.
When i drag and drop a file on to a selected record in the grid, i am able to call a modal form in Grid_DragDrop
event. But this modal form blocks everything until it is closed instead of just blocking access to the application. Also when i move this modal form around, i see trail of form moving and it does not go away until i close the form.
I am able to call the same modal form on a button click and able to move it around. No trail of form and it refreshes fine. It only blocks the application and not the desktop.
I am clueless about why this is happening only when i call modal form in DragDrop event?
Showing modal forms from DragDrop event is REALLY bad idea. Basically you make your app go haywire because it cannot do what windows require of it during DragDrop (including redrawing both DragDrop source (desktop?) and target).
Use DragDrop event ONLY to register what is being dropped and then process it afterwards.
精彩评论