点击下载此附件示例中:
功能一:我(标签0)的宽度会随窗体的宽度变化而变化,窗体的页眉、页脚及子窗体(Child0)的宽度也与我一样,并且子窗体(Child0)的高度也随窗体的高度变化而变化
功能二:利用组合框来控制子窗体的所要显示的源对象(表、查询、子窗体(窗体)),示例中只对表和查询作为源对象的展示,子窗体(窗体),也是一样,依样画符可也,
VBA代码:
Private Sub Cbo1_AfterUpdate() '---------[Cbo1]组合框更新事件
Me.Child0.SourceObject = Me.Cbo1
Me.Child0.Requery
'Me.Refresh
End Sub
Private Sub Form_Load() '----------如果注释掉加载事件,打开窗体时,[Child0]子窗体为空白
Me.Child0.SourceObject = "表.表1"
End Sub
Private Sub Form_Resize()
'Me.Painting = False
Me.Child0.Width = Me.InsideWidth
Me.标签0.Width = Me.InsideWidth - 1134
Me.Child0.Height = Me.InsideHeight - Me.Section(acHeader).Height - Me.Section(acFooter).Height
topline.Width = Me.InsideWidth
bottomline1.Width = Me.InsideWidth
'Me.Painting = True
End Sub