Upravit

Sdílet prostřednictvím


Page.DrawRectangle method (Visio)

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

Syntax

expression. DrawRectangle( _x1_ , _y1_ , _x2_ , _y2_ )

expression A variable that represents a Page object.

Parameters

Name Required/Optional Data type Description
x1 Required Double The x-coordinate of one corner of the rectangle's width-height box.
y1 Required Double The y-coordinate of one corner of the rectangle's width-height box.
x2 Required Double The x-coordinate of the other corner of the rectangle's width-height box.
y2 Required Double The 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.

 
Public Sub DrawRectangle_Example() 
 
 Dim vsoShape As Visio.Shape 
 
 Set vsoShape = ActivePage.DrawRectangle(1, 4, 4, 1) 
 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.