|
The class that is
passed into the DoDragDrop function needs to inherit from
Autodesk.AutoCAD.Windows.DropTarget and also needs to override the OnDrop
function. In the OnDrop function you
define what happens when the drop occurs. In this example a function AddAnEnt
of the adskClass is being run. Notice that the active document is being
locked by creating a DocumentLock variable. The document needs to be locked when dragging and
dropping if objects are going to be opened in the document. When AddAnEnt is
run from a command like was done in previous labs, document locking is taken
care of automatically. Because AddAnEnt is going to be opening database
objects and is not run from a command, the document needs to be locked or an
eLockViolation error would occur. The using, and end using statement with a
DocumentLock variable will lock and unlock the document.
|