Rs.Open "select * from tableMB where cla=1 and upkey<>0 and upkey<>'" & TabKey(IntKey) & "' and result='" & TabKey(IntKey) & "' and chose=1 order by xkey", Ocn, adOpenDynamic, adLockReadOnly Do Until Rs.EOF Set ds = TView.Nodes.Add("key" + Trim(Str(Rs.Fields!upkey)), 4, "key" + Trim(Str(Rs.Fields!xkey)), Rs.Fields!xname) Rs.MoveNext IntNo = IntNo + 1 Loop Rs.Close
TmpLeft = 120 IntTop = 200 IntLeft = 120 TviewNo = 1 SSTab.Tab = IntKey Load Pic(IntKey + 1) Pic(IntKey + 1).Width = Pic(0).Width Pic(IntKey + 1).Height = Pic(0).Height Pic(IntKey + 1).Container = SStab StartNo(IntKey) = TviewIndex + 1 Do Until IsEnd = True Load Lab(TviewIndex + 1) Lab(TviewIndex + 1).Caption = TView.Nodes(TviewNo).Text Lab(TviewIndex + 1).Top = IntTop Lab(TviewIndex + 1).Left = IntLeft Lab(TviewIndex + 1).Container = Pic(IntKey + 1) Lab(TviewIndex + 1).Visible = True Load Com(TviewIndex + 1) Com(TviewIndex + 1).Top = IntTop - 50 Com(TviewIndex + 1).Left = IntLeft + 1000 Com(TviewIndex + 1).Container = Pic(IntKey + 1) If TView.Nodes(TviewNo).Children > 0 Then Com(TviewIndex + 1).Visible = False IntLeft = IntLeft + 1250 TmpLeft = IntLeft TviewNo = TView.Nodes(TviewNo).Child.Index Else Com(TviewIndex + 1).Visible = True If Not (TView.Nodes(TviewNo).Next Is Nothing) Then TviewNo = TView.Nodes(TviewNo).Next.Index IntLeft = IntLeft + Com(TviewIndex + 1).Width + 1100 If IntLeft > 10000 - 1000 Then IntLeft = TmpLeft IntTop = IntTop + 350 End If Else IntTop = IntTop + 500 If Not (TView.Nodes(TviewNo).Parent Is Nothing) Then If Not (TView.Nodes(TviewNo).Parent.Next Is Nothing) Then IntLeft = TmpLeft - 1250 TviewNo = TView.Nodes(TviewNo).Parent.Next.Index End If Else IsEnd = True End If End If End If TviewIndex = TviewIndex + 1 Loop EndNo(IntKey) = TviewIndex Pic(IntKey + 1).Visible = True TabKey(IntKey) = 0 IsEnd = False
Do Until Rs.EOF
Set ds = TView.Nodes.Add("key" + Trim(Str(Rs.Fields!upkey)), 4, "key" + Trim(Str(Rs.Fields!xkey)), Rs.Fields!xname)
Rs.MoveNext
IntNo = IntNo + 1
Loop
Rs.Close
TmpLeft = 120
IntTop = 200
IntLeft = 120
TviewNo = 1
SSTab.Tab = IntKey
Load Pic(IntKey + 1)
Pic(IntKey + 1).Width = Pic(0).Width
Pic(IntKey + 1).Height = Pic(0).Height
Pic(IntKey + 1).Container = SStab
StartNo(IntKey) = TviewIndex + 1
Do Until IsEnd = True
Load Lab(TviewIndex + 1)
Lab(TviewIndex + 1).Caption = TView.Nodes(TviewNo).Text
Lab(TviewIndex + 1).Top = IntTop
Lab(TviewIndex + 1).Left = IntLeft
Lab(TviewIndex + 1).Container = Pic(IntKey + 1)
Lab(TviewIndex + 1).Visible = True
Load Com(TviewIndex + 1)
Com(TviewIndex + 1).Top = IntTop - 50
Com(TviewIndex + 1).Left = IntLeft + 1000
Com(TviewIndex + 1).Container = Pic(IntKey + 1)
If TView.Nodes(TviewNo).Children > 0 Then
Com(TviewIndex + 1).Visible = False
IntLeft = IntLeft + 1250
TmpLeft = IntLeft
TviewNo = TView.Nodes(TviewNo).Child.Index
Else
Com(TviewIndex + 1).Visible = True
If Not (TView.Nodes(TviewNo).Next Is Nothing) Then
TviewNo = TView.Nodes(TviewNo).Next.Index
IntLeft = IntLeft + Com(TviewIndex + 1).Width + 1100
If IntLeft > 10000 - 1000 Then
IntLeft = TmpLeft
IntTop = IntTop + 350
End If
Else
IntTop = IntTop + 500
If Not (TView.Nodes(TviewNo).Parent Is Nothing) Then
If Not (TView.Nodes(TviewNo).Parent.Next Is Nothing) Then
IntLeft = TmpLeft - 1250
TviewNo = TView.Nodes(TviewNo).Parent.Next.Index
End If
Else
IsEnd = True
End If
End If
End If
TviewIndex = TviewIndex + 1
Loop
EndNo(IntKey) = TviewIndex
Pic(IntKey + 1).Visible = True
TabKey(IntKey) = 0
IsEnd = False
也就是tab的值
比如我点第1个tab的时候,传进来0,我就load picture(1),并把picture(1)放在此tab上
如果点我第2个tab的时候,传进来1,我就load picture(2),并把picture(2)放在此tab上
郁闷
SSTab1.Tab = 0
Load Picture1(1)
Picture1(1).Visible = True
Picture1(1).Top = 100
Set Picture1(1).Container = SSTab1
End SubPrivate Sub Command3_Click()'在第二个Tab 加一个Picture1
SSTab1.Tab = 1
Load Picture1(2)
Picture1(2).Width = Picture1(1).Width
Picture1(2).Visible = True
Picture1(2).Top = 200
Set Picture1(2).Container = SSTab1
End Sub