十一、InsideHeight、InsideWidth 属性 InsideHeight 返回窗体中客户区的高度,以磅为单位。InsideWidth 返回窗体中客户区的宽度,以磅为单位。 语法: object.InsideHeight object.InsideWidth 说明:InsideHeight 和 InsideWidth 属性是只读的。如果该区含有滚动条,则返回的值不包括滚动条的高度和宽度 示例:将标签控件铺满窗体。在窗体上放置一个标签控件,一个命令按钮。属性设置如下: 控件\对象 Name属性 UserForm1 frmTiled Label1 lblTiled Commandbutton1 cmdLabelTiled
Private Sub cmdLabelTited_Click() Dim Counter As Long lblTiled.Caption = "窗体最大可用高度: " & frmTiled.InsideHeight & vbCrLf & _ "窗体最大可用宽度: " & frmTiled.InsideWidth lblTiled.Height = frmTiled.InsideHeight lblTiled.Width = frmTiled.InsideWidth lblTiled.Top = 0 lblTiled.Left = 0 For Counter = 1 To 100000 DoEvents Next Counter lblTiled.Height = 20 lblTiled.Width = 120 lblTiled.Left = (frmTiled.InsideWidth - 120) / 2 lblTiled.Top = (frmTiled.InsideHeight - 20) / 2 End Sub |