OptionGroup.InSelection 属性 (Access)OptionGroup.InSelection property (Access)

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

语法Syntax

expressionexpression. InSelection

_表达式_一个代表OptionGroup对象的变量。expression A variable that represents an OptionGroup 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

选项组对象OptionGroup Object