【正文】
= 1 To 1 If (i).Name = A Then txcs = True If txcs = False Then = amp。 (i).Name amp。 : amp。 (i) amp。 Chr(10) Else = amp。 (i).Name amp。 : amp。 (i) amp。 Chr(10) End If Next iEnd SubPrivate Sub ListBox1_Click() (select * from amp。 ) For i = 0 To 1 (0) Next i xhs = = (0) = LoadPicture(E:\程序設計\PIC\ amp。 amp。 .jpg)End SubPrivate Sub UserForm_Initialize() 39。初始化窗體 39。初始化型鋼種類 39。初始化型鋼型號 (select * from 目錄 ORDER BY 名稱 desc) For i = 0 To 1 (0) Next i (select * from amp。 (0)) For i = 0 To 1 (0) Next i xhs = (0) = (0) = LoadPicture(E:\程序設計\PIC\ amp。 (0) amp。 .jpg)End SubB2 VBA模塊代碼39。*********************************************************39。**模 塊 名:openData39。**功能描述:打開數(shù)據(jù)庫 打開記錄集 關閉數(shù)據(jù)庫39。*********************************************************Option ExplicitPublic conn As Public rest As Public strSQL As String39。打開記錄集Public Function openDb(ByVal SQL As String) As Set rest = New SQL, conn, adOpenKeyset, adLockOptimistic 39。打開記錄集End Function39。關閉數(shù)據(jù)庫Public Sub closeDb()End Sub39。打開數(shù)據(jù)庫Public Sub openD() Dim ConnectString As String, DataSourceStr As String Set conn = New DataSourceStr = E:\程序設計\ConnectString = Provider=。Data Source= amp。 DataSourceStr 39。39。 連接數(shù)據(jù)庫字符串 ConnectString 39。連接數(shù)據(jù)庫End Sub39。*********************************************************39。**模 塊 名:tool39。**說 明:創(chuàng)建菜單,工具欄并設置其單擊顯示窗口 調(diào)用圖層設置模塊39。*********************************************************39。*********************************************************39。**函 數(shù) 名:main39。**功能描述: 創(chuàng)建工具欄 菜單 調(diào)用圖層設置模塊39。*********************************************************Public Sub main() Dim currMenuGroup As AcadMenuGroup Dim newToolbar As AcadToolbar Set currMenuGroup = (0) 39。 創(chuàng)建新工具欄 Dim newButton As AcadToolbarItem Set newToolbar = (TestToolbar) Dim openMacro As String 39。 給宏指定“ESC ESC _open”的 VB 等價值 openMacro = vbarun + Chr(32) + + Chr(32) Set newButton = _ (, 鋼結(jié)構(gòu)元件繪制, 顯示繪圖窗體, openMacro) openMacro = vbarun + Chr(32) + + Chr(32) Set newButton = _ (, 鋼結(jié)構(gòu)元件管理, 顯示管理窗體, openMacro) 39。獲得當前的菜單組 Set currMenuGroup = (0) 39。 創(chuàng)建新菜單路基管理菜單 Dim yjgl As AcadPopupMenu Set yjgl = (鋼結(jié)構(gòu)元件管理2( amp。 Chr(Asc(amp。)) amp。 L)) 39。添加菜單項 macro = Chr(vbKeyEscape) + Chr(vbKeyEscape) 39。相當于按下兩次Esc鍵 39。自動繪圖菜單項 Dim hsmt As AcadPopupMenuItem Set hsmt = ( + 1, 繪三面圖( amp。 Chr(Asc(amp。)) amp。 H), _ macro amp。 vbarun + Chr(32) + + Chr(32)) 39。型鋼表子菜單項 Dim xgb As AcadPopupMenuItem Set xgb = ( + 1, 型鋼表( amp。 Chr(Asc(amp。)) amp。 B), _ macro amp。 vbarun + Chr(32) + + Chr(32)) 39。型鋼數(shù)據(jù)管理子菜單項 Dim xgsjgl As AcadPopupMenuItem Set xgsjgl = ( + 1, 關于(( amp。 Chr(Asc(amp。)) amp。 S), _ macro amp。 vbarun + Chr(32) + + Chr(32)) 39。 在菜單欄上顯示菜單************************************************************************* ( + 1) 39。 調(diào)用圖層設置模塊 End Sub 39。顯示繪圖窗口Public Sub xsct() End Sub 39。顯示型鋼表Public Sub xgcx() End Sub 39。顯示關于窗口Public Sub about() End Sub39。************************************************************************39。**模 塊 名:tuceng39。**說 明:圖層設置模塊39。************************************************************************39。、中心線線型、點畫線線型、雙點畫線線型和波浪線線型39。創(chuàng)建圖層Public csx As AcadLayer 39。粗實線Public xsx As AcadLayer 39。細實線Public blx As AcadLayer 39。波浪線Public szx As AcadLayer 39。雙折線Public xx As AcadLayer 39。虛線Public xdhx As AcadLayer 39。細點畫線Public cdhx As AcadLayer 39。粗點畫線Public sdhx As AcadLayer 39。雙點畫線Public framelayer As AcadLayer 39。圖框線Public titlelayer As AcadLayer 39。標題欄線Public Sub loadlinetype() Dim entry As AcadLineType Dim found As Boolean Dim ltname(0 To 4) As String Dim i As Integer found = False ltname(0) = HIDDEN ltname(1) = CENTER ltname(2) = DASHDOT ltname(3) = DIVIDE ltname(4) = ZIGZAG For i = 0 To 4 39。先查看已加載的圖層里有沒有 For Each entry In If StrComp(, ltname(i), 1) = 0 Then found = True Exit For End If Next 39。如果不存在則將其從線型文件acad.1in中加載 If Not (found) Then ltname(i), NextEnd Sub39。雙折線沒定義Public Sub layer() 39。加載線型 Call loadlinetype 39。使用圖層名 Set csx = (csx) Set xsx = (xsx) Set blx = (blx) Set szx = (szx) Set xx = (xx) Set xdhx = (xdhx) Set cdhx = (cdhx) Set sdhx = (sdhx) Set framelayer = (framelayer) Set titlelayer = (titlelayer) 39。定制csx層 Set layobj = (csx) = 7 = Continuous 39。定制xsx層 Set layobj = (xsx) = 1 = Continuous 39。定制blx層 Set layobj = (blx) = 3 = ZIGZAG 39。定制szx層 Set layobj = (szx) = 5 = Continuous 39。定制xx層 Set layobj = (xx) = 2 = HIDDEN 39。定制xdhx層 Set layobj = (xdhx) Dim Color As AcadAcCmColor Set Color = () Call (223, 255, 127) = Color = DASHDOT 39。定制cdhx層 Set layobj = (cdhx) Dim Color1 As AcadAcCmColor Set Color1 = () Call (38, 66, 78) = Color1 = DASHDOT 39。定制sdhx層 Set layobj = (sdhx) = 6 = DIVIDE 39。定制framelayer層 Set layobj = (framelayer) = acGreen = Continuous 39。定制titlelayer層 Set layobj = (titlelayer) = acWhite = ContinuousEnd SubPublic x As Double 39。x坐標變量Public y As Double 39。y坐標變量Public xp As Double 39。光標輸入點坐標Public yp As Double 39。光標輸入點坐標Public x0 As Double 39。圓心點Public y0 As DoublePublic xj As Double 39。交點Public yj As Double39。***********************************