This documentation is archived and is not being maintained.

Page.DrawRectangle Method

Office 2007
Adds a rectangle to the Shapes collection of a page, master, or group.

Version Information
 Version Added:  Visio 2.0

Syntax

expression.DrawRectangle(x1, y1, x2, y2)

expression   A variable that represents a Page object.

Parameters

NameRequired/OptionalData TypeDescription
x1RequiredDoubleThe x-coordinate of one corner of the rectangle's width-height box.
y1RequiredDoubleThe y-coordinate of one corner of the rectangle's width-height box.
x2RequiredDoubleThe x-coordinate of the other corner of the rectangle's width-height box.
y2RequiredDoubleThe y-coordinate of the other corner of the rectangle's width-height box.

Return Value
Shape

Remarks

Using the DrawRectangle method is equivalent to using the Rectangle tool in the application. The arguments are in internal drawing units with respect to the coordinate space of the page, master, or group where the rectangle is being placed.

Example

The following example shows how to draw a rectangle on the active page.

Visual Basic for Applications

Public Sub DrawRectangle_Example() 

    Dim vsoShape As Visio.Shape
 
    Set vsoShape = ActivePage.DrawRectangle(1, 4, 4, 1) 

End Sub  



Show: