Table of contents
TOC
折叠目录
展开目录

Window.GetWindowRect 方法 (Visio)Window.GetWindowRect Method (Visio)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

获取窗口客户区的大小和位置。Gets the size and position of the client area of a window.

语法Syntax

表达式GetWindowRectpnLeftpnToppnWidth ( pnHeightexpression . GetWindowRect( pnLeft , pnTop , pnWidth , pnHeight )

表达式_一个表示一个窗口对象的变量。_expression A variable that represents a Window object.

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
pnLeftpnLeft必需RequiredLongLong窗口左侧的坐标。The coordinate of the left side of the window.
pnToppnTop必需RequiredLongLong窗口顶部的坐标。The coordinate of the top of the window.
pnWidthpnWidth必需RequiredLongLong从窗口左侧到右侧的距离(以像素为单位)。The distance in pixels from the left side to the right side of the window.
pnHeightpnHeight必需RequiredLongLong从窗口顶部到底部的距离(以像素为单位)。The distance in pixels from the top to the bottom of the window.

返回值Return Value

Nothing

注解Remarks

GetWindowRect方法可获取的大小和位置相对于窗口拥有Windows集合所属窗口的工作区。对于Windows应用程序对象的集合,"相对于"窗口是 Microsoft Visio 主窗口的 MDICLIENT 窗口。对于窗口Window对象集合,"相对于"窗口是绘图窗口的工作区。The GetWindowRect method gets the size and position of the client area of the window with respect to the window that owns the Windows collection to which it belongs. For the Windows collection of an Application object, the "with respect to" window is the MDICLIENT window of the Microsoft Visio main window. For the Windows collection of a Window object, the "with respect to" window is the client area of the drawing window.

示例Example

下面的示例演示如何使用GetWindowRect方法来获取的大小和位置的窗口对象。它打开Pan&;放大窗口打印窗口的坐标、 宽度和高度,在立即窗口中的。The following example shows how to use the GetWindowRect method to get the size and position of a Window object. It opens the Pan &; Zoom window and prints the window's coordinates, width, and height in the Immediate window.

Public Sub GetWindowRect_Example() 

 Dim vsoApplication As Visio.Application 
 Dim vsoPZWindow As Visio.Window 
 Dim pinLeft As Long, pinTop As Long, pinWidth As Long, pinHeight As Long 

 Set vsoApplication = Visio.Application 

 'Display the Pan &; Zoom window 
 Set vsoPZWindow = vsoApplication.ActiveWindow.Windows.ItemFromID(visWinIDPanZoom) 
 vsoPZWindow.Visible = True 

 'Get the existing window size and position 
 vsoPZWindow.GetWindowRect pinLeft, pinTop, pinWidth, pinHeight 
 Debug.Print pinLeft, pinTop, pinWidth, pinHeight 

 'Change the window height and get the new values 
 vsoPZWindow.SetWindowRect pinLeft, pinTop, pinWidth, pinHeight + 50 
 vsoPZWindow.GetWindowRect pinLeft, pinTop, pinWidth, pinHeight 
 Debug.Print pinLeft, pinTop, pinWidth, pinHeight 

End Sub
© 2018 Microsoft