明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1353|回复: 2

高手请赐教!

[复制链接]
发表于 2004-7-1 17:21:00 | 显示全部楼层 |阅读模式
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函数是不能实现的,不知道有没有办法实现?请高手赐教!
发表于 2004-7-1 17:32:00 | 显示全部楼层
set me.Controls("Image" &amp; i+1).picture=loadpicture(filename)
 楼主| 发表于 2004-7-1 18:02:00 | 显示全部楼层
谢谢!飞狐兄!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-28 04:32 , Processed in 0.144397 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表