Public ptcen As Variant Public bpick As Boolean Public strpath As String
Private Sub Form_Load() Dim strtemp As String Dim nfile, listnum, m As Integer On Error GoTo errhandler nfile = FreeFile bpick = False Open App.Path & "\xiaolin.INI" For Input As #nfile listnum = 1 ctListBar1.IconSize = IconSmall While Not EOF(nfile) Line Input #nfile, strtemp If Left$(strtemp, 1) = "*" Then strtemp = Right$(strtemp, (Len(strtemp) - 2)) 'MsgBox InStr(strtemp, ",") ctListBar1.AddList strtemp listnum = listnum + 1 Else m = InStr(strtemp, ",") - 1 strtemp = Left$(strtemp, m) intListNum = listnum 'If intListNum <> 0 Then strItemName = strtemp If strtemp <> "" Then ctListBar1.AddListItem listnum, strtemp, ctListBar1.Image1 End If Wend Close #nfile Exit Sub errhandler: MsgBox "error no." Err.Clear End Sub Private Sub ctListBar1_ItemClick(ByVal nList As Integer, ByVal nItem As Integer) Dim strtemp As String Dim nfile, listnum As Integer nfile = FreeFile MsgBox "你点击的项目名称是:" & ctListBar1.ItemText(nList, nItem), vbInformation, nList & "-" & nItem Open App.Path & "\xiaolin.INI" For Input As #nfile While Not EOF(nfile) Line Input #nfile, strtemp If Left$(strtemp, InStr(strtemp, ",")) = ctListBar1.ItemText(nList, nItem) & "," Then strtemp = Right$(strtemp, (Len(strtemp) - InStr(strtemp, ","))) 'MsgBox ctListBar1.ItemText(nList, nItem) MsgBox "ThisDrawing.SendCommand" & " (""" & strtemp & """ & vbCr)" End If Wend Close #nfile End Sub xiaolin.ini文件内容 原理线,LINE **常开 普通常开,(JXYJ1 "CK_1") 刀开关常开,(JXYJ1 "CK_18") 负荷开关,(JXYJ1 "CK_20") 断路器常开,(JXYJ1 "CK_19") 接触器常开,(JXYJ1 "CK_17") 按钮常开,(JXYJ1 "CK_3") 热继电器常开,(JXYJ1 "CK_14") **常闭 普通常闭,(JXYJ1 "CB_1") 按钮常闭,(JXYJ1 "CB_2") 热继电器常闭,(JXYJ1 "CB_5") **线圈 普通线圈,(JXYJ1 "XQ_1") 时间继电器,(JXYJ1 "XQ_2") 过流继电器,(JXYJ1 "XQ_3") 欠流继电器,(JXYJ1 "XQ_4") 过压继电器,(JXYJ1 "XQ_5") 欠压继电器,(JXYJ1 "XQ_6") **其他元件
这是我春节期间做的 1.新建一个窗体 名为Form 2.在上面放置CTLISTBAR控件名为ctListBar1 3.xiaolin.ini文件与工程文件放在同一目录下 而今问题如下: 1.如何将相应的命令发送到CAD里执行? 2.如何实现VB直接操作CAD运行相应命令? 3.生成EXE文件时为什么会没有调试时的界面? |