Drop Method [Visio 2003 SDK Documentation]

As it applies to the Document object, Masters collection, and MasterShortcuts collection.

Creates a new Master object by dropping an object onto a receiving object such as a stencil or document, or the Masters or MasterShortcuts collection.

objRet = object**.Drop**(dropObject, x, y)

objRet     The Master or MasterShortcut object created by dropping dropObject.

object     Required. An expression that returns an object in the Applies to list. The object to receive dropObject.

dropObject     Required. The object to drop. While this is typically a Visio object such as a Master, Shape, or Selection object, it can be any OLE object that provides an IDataObject interface.

x     Required Integer. The x-coordinate at which to place the center of the shape's width or PinX.

y    Required Integer. The y-coordinate at which to place the center of the shape's height or PinY.

Version added

2.0

Remarks

Using the Drop method is similar to dragging and dropping a shape with the mouse. The object dropped (dropObject) can be a master or a shape on the drawing page.

If dropObject is a Master, the pin of the master is dropped at the specified coordinates. A master's pin is often, but not necessarily, at its center of rotation.

To create a new master in a stencil, apply the Drop method to a Document object that represents a stencil (the stencil must be opened as an original or a copy rather than read-only). In this case, thex and y arguments are ignored, and the new master that is created is returned.

As it applies to the Master, Page, and Shape objects.

Creates one or more new Shape objects by dropping an object onto a receiving object such as a master, drawing page, shape, or group.

objRet = object**.Drop**(dropObject, x, y)

objRet     If dropObject is a single object, the Shape object created. If dropObject is a selection, the Drop method returns Nothing.

object    Required. An expression that returns an object in the Applies to list. The object to receive dropObject.

dropObject     Required. The object or selection to drop. While this is typically a Visio object such as a Master, Shape, or Selection object; it can be any OLE object that provides an IDataObject interface.

x     Required Double. The x-coordinate at which to place the center of the shape's width or PinX.

y    Required Double. The y-coordinate at which to place the center of the shape's height or PinY.

Version added

2.0

Remarks

Using the Drop method is similar to dragging and dropping a shape with the mouse. The object dropped (dropObject) can be a master or a shape on the drawing page.

To add a shape to a group or on a drawing page, apply the Drop method to a Shape or Page object, respectively. The center of the shape's width-height box is positioned at the specified coordinates, and a Shape object that represents the shape that is created is returned. When applying this method to a Shape object, make sure that the Shape object represents a group.

If dropObject is a Master, the pin of the master is dropped at the specified coordinates. A master's pin is often, but not necessarily, at its center of rotation.

Example

As it applies to the Document object.

The following example shows how to use the Drop method to create a master by dropping a shape onto a Document object.

Public Sub Drop_Example1()

    Dim vsoShape As Visio.Shape 
    Dim vsoMaster As Visio.Master 

    Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1) 

    'Create a master in the document. 
    'The master appears on the document stencil. 
    Set vsoMaster = ActiveDocument.Drop(vsoShape,  0, 0) 

End Sub  

As it applies to the Page and Shape objects.

The following example shows how to use the Drop method to drop shapes onto Page and Shape objects.

Public Sub Drop_Example2()
 
    Dim vsoShape1 As Visio.Shape 
    Dim vsoShape2 As Visio.Shape 
    Dim vsoShape3 As Visio.Shape 
    Dim vsoGroupShape As Visio.Shape 
    Dim vsoSubShape As Visio.Shape 
    Dim vsoSelection As Visio.Selection
 
    Set vsoShape1 = ActivePage.DrawRectangle(1, 2, 2, 1) 
    Set vsoShape2 = ActivePage.DrawRectangle(1, 4, 2, 3) 

    'Drop a shape on the page. 
    Set vsoShape3 = ActivePage.Drop(vsoShape1, 3.5, 3.5) 

    'Make sure only one shape is selected to start. 
    Set vsoSelection = ActiveWindow.Selection
    vsoSelection.Select vsoShape1, visDeselectAll + visSelect 
    vsoSelection.Select vsoShape2, visSelect 

    'Create a group shape. 
    Set vsoGroupShape = vsoSelection.Group 

    'Drop a shape on the group shape to create a new subshape. 
    Set vsoSubShape = vsoGroupShape.Drop(vsoShape3, 1, 2) 

End Sub

Applies to | Document object | Master object | Masters collection | MasterShortcuts collection | Page object | Shape object