- 积分
- 1536
- 明经币
- 个
- 注册时间
- 2003-1-12
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
Private Sub TvwTK_Click() Additems End Sub
Private Sub UserForm_Initialize() Ini_userform
End Sub Sub Ini_userform()
SysPath = ThisDrawing.GetVariable("users5")
IniTvwtk
With Me .Image1.SpecialEffect = fmSpecialEffectRaised .Image2.SpecialEffect = fmSpecialEffectRaised .Image3.SpecialEffect = fmSpecialEffectRaised .Image4.SpecialEffect = fmSpecialEffectRaised .Image5.SpecialEffect = fmSpecialEffectRaised .Image6.SpecialEffect = fmSpecialEffectRaised .Image7.SpecialEffect = fmSpecialEffectRaised .Image8.SpecialEffect = fmSpecialEffectRaised .Image9.SpecialEffect = fmSpecialEffectRaised .Image10.SpecialEffect = fmSpecialEffectRaised .Image11.SpecialEffect = fmSpecialEffectRaised .Image12.SpecialEffect = fmSpecialEffectRaised End With End Sub
Sub IniTvwtk() On Error GoTo ErrHandler Dim MyName, path_W Dim S, F As Nodes Dim i
i = 0 SysPath = ThisDrawing.GetVariable("users5")
path_W = SysPath + "lib\"
Me.TvwTK.LineStyle = tvwTreeLines Me.TvwTK.HideSelection = False
Me.TvwTK.BorderStyle = ccNone On Error Resume Next
Me.TvwTK.LineStyle = tvwRootLines F.Image = "library" F.Expanded = True
MyName = Dir(path_W, vbDirectory) Do While MyName <> "" If MyName <> "." And MyName <> ".." Then If (GetAttr(path_W & MyName) And vbDirectory) = vbDirectory Then i = i + 1 Set F = Me.TvwTK.Nodes.Add(, , "F" & i, Trim(MyName)) End If End If MyName = Dir Loop
ErrHandler: Exit Sub End Sub
Sub Additems() Dim nodeDwgName As Node Dim tmpstr As String Dim strKey As String Dim strKey1 As String Dim strParent As String Dim tmp_FileName As String Dim File_List Dim tmpNode As Node Dim tmpKey As String Dim ww Dim Path_Lib As String Dim i As Integer Dim j As Integer SysPath = ThisDrawing.GetVariable("users5")
Path_Lib = SysPath + "lib\"
If TvwTK.SelectedItem.Children = 0 Then strKey = Trim(TvwTK.SelectedItem.Key) tmpstr = Trim(TvwTK.SelectedItem.Text) strKey1 = Left(strKey, 1) Select Case strKey1 Case "F" File_List = W_GetFileListByPath(Path_Lib + tmpstr + "\", "") For i = LBound(File_List) To UBound(File_List) tmp_FileName = Left(File_List(i), Len(File_List(i)) - 4) Set nodeDwgName = TvwTK.Nodes.Add(strKey, tvwChild, "S" & strKey & i, tmp_FileName) ww = ss(i, Path_Lib + tmpstr + "\" + File_List(i)) Next i 'Me.Label1.Caption = Trim(TvwTK.SelectedItem.Text) Case "S" StrFileName = Trim(TvwTK.SelectedItem.Text) tmpKey = Right(Trim(TvwTK.SelectedItem.Key), 1) ' j = Val(tmpKey) + 1 ' If j / 12 <= 1 Then ' ss = "Me.Image" & j & ".Picture =" & "" ' TvwTK ' ElseIf j / 12 <= 2 Then ' ElseIf j / 12 <= 3 Then ' ElseIf j / 12 <= 4 Then ' End If Set tmpNode = TvwTK.SelectedItem.Parent strParent = tmpNode.Text StrFilePath = Path_Lib & strParent & "\" & Trim(TvwTK.SelectedItem.Text) 'Me.Label1.Caption = StrFileName
End Select End If End Sub Function ss(i As Integer, FileName As String) As Variant ss = "me.Image" & i + 1 & ".picture=" & FileName & vbCr End Function
程序中我不想一个一个的写语句将image的picture付值,我想通过函数ss这样的形式实现,当然了我写的ss函数是不能实现的,不知道有没有办法实现?请高手赐教! |
|