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

Rectangle.InSelection 属性 (访问)Rectangle.InSelection Property (Access)

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

您可以使用InSelection属性可以确定或指定是否选择了设计视图中的窗体上的控件。读/写boolean 类型的值You can use the InSelection property to determine or specify whether a control on a form in Design view is selected. Read/write Boolean.

语法Syntax

表达式InSelectionexpression. InSelection

表达式_一个表示矩形对象的变量。_expression A variable that represents a Rectangle object.

注解Remarks

在选中某控件时,它的尺寸控点会显示,并且用户可以调整它的大小。一次可选择多个控件。When a control is selected, its sizing handles are visible and it can be resized by the user. More than one control can be selected at a time.

示例Example

下面的函数使用InSelection属性来确定是否strControlName在窗体上的控件处于选定状态。The following function uses the InSelection property to determine whether the strControlName control on a form is selected.

如果要试验下列代码,可将 IsControlSelected 函数代码粘贴到“罗斯文”示例数据库某一代码模块中的声明节,在设计视图中打开“客户”窗体,然后选取“公司名称”控件。在“调试”窗口中输入以下代码行:To test this code, paste the IsControlSelected function code in the Declarations section of a code module in the Northwind sample database, open the Customers form in Design view, and select the CompanyName control. Then enter the following line in the Debug window:

? IsControlSelected (Forms!Customers, "CompanyName") 

Function IsControlSelected(frm As Form, _ 
 strControlName As String) As Boolean 
 Dim intI As Integer, ctl As Control 
 If frm.CurrentView <> 0 Then 
 ' Form is not in Design view. 
 Exit Function 
 Else 
 For intI = 0 To frm.Count - 1 
 Set ctl = frm(intI) 
 If ctl.InSelection = True Then 
 ' Is desired control selected? 
 If UCase(ctl.Name) = UCase(strControlName) Then 
 IsControlSelected = True 
 Exit Function 
 End If 
 Else 
 IsControlSelected = False 
 End If 
 Next intI 
 End If 
End Function

另请参阅See also

概念Concepts

矩形对象Rectangle Object

© 2018 Microsoft