已知:Frame3在sstabView控件里面:
要求打印窗体时只打印Frame3里面的控件,隐藏sstabView
实现方法:
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
'打印窗体
Private Sub tbLeft_Click()
'显示需要打印的 Frame3 个控件
SetParent Frame3.hwnd, Me.hwnd
'隐藏sstabView
sstabView.Visible = False
'打印窗体
Me.PrintForm
'打印完毕后显示打印时隐藏过的控件
SetParent Frame3.hwnd, sstabView.hwnd
sstabView.Visible = True
end sub