指定布局的 Tab 键顺序。 支持的平台:仅窗口 属性值只读:不 类型:长 布局的 Tab 键顺序。 言论此属性控制布局在选项卡控件中的显示顺序。Tab 键顺序在数据库中的所有布局中应该是唯一的和顺序的。 模型空间选项卡的制表符顺序必须为零 (0)。图纸空间制表符的 Tab 键顺序必须为 1 或更大。 例子工 务 局: Sub Example_TabOrder() ' This example creates two new Layouts, sets the TabOrder of the Layouts to be ' in alphabetic order, and displays a list of Layouts in the order they appear ' in the tabs. Dim Layout1 As ACADLayout, Layout2 As ACADLayout Dim SortLayoutRight As ACADLayout, SortLayoutLeft As ACADLayout Dim SortIt As New Collection Dim TabCount As Long, SortCount As Long, TabOrder As Long Dim TabName As String, SortText As String, msg As String Dim tempLayout As ACADLayout Dim AddedTab As Boolean ' Create new Layouts On Error Resume Next Set Layout1 = ThisDrawing.Layouts.Add("Z VIEW") Set Layout2 = ThisDrawing.Layouts.Add("A VIEW") On Error GoTo 0 ' Alphabetize internally For TabCount = 0 To (ThisDrawing.Layouts.count - 1) AddedTab = False TabName = ThisDrawing.Layouts(TabCount).name If TabName = "Model" Then GoTo SKIP ' Skip modelspace If SortIt.count = 0 Then SortIt.Add TabName ' Add to beginning of list Else For SortCount = 1 To SortIt.count ' Add to list by string SortText = SortIt(SortCount) If StrComp(TabName, SortText, vbTextCompare) = -1 Then If SortCount = 1 Then SortIt.Add TabName ' Add as first item Else SortIt.Add TabName, , SortCount ' Add as previous item End If AddedTab = True Exit For End If Next If Not (AddedTab) Then SortIt.Add TabName, , , SortIt.count ' Add if we haven't yet End If SKIP: Next ' Write new ACAD tab order For SortCount = 1 To SortIt.count Set tempLayout = ThisDrawing.Layouts(SortIt(SortCount)) tempLayout.TabOrder = SortCount Next '------------------------------- ' Read and display New Tab Order '------------------------------- msg = "The tab order is now set to: " & vbCrLf & vbCrLf For TabCount = 0 To (ThisDrawing.Layouts.count - 1) TabName = ThisDrawing.Layouts(TabCount).name If TabName = "Model" Then GoTo SKIP2 ' Don't show modelspace TabOrder = ThisDrawing.Layouts(TabCount).TabOrder msg = msg & "(" & TabOrder & ")" & vbTab & TabName & vbCrLf SKIP2: Next MsgBox msg, vbInformation End Sub Visual LISP: (vl-load-com) (defun c:Example_TabOrder() ;; This example creates two new Layouts, sets the TabOrder of the Layouts to be ;; in alphabetic order, and displays a list of Layouts in the order they appear ;; in the tabs. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Create new Layouts (setq Layout1 (vla-Add (vla-get-Layouts doc) "Z VIEW")) (setq Layout2 (vla-Add (vla-get-Layouts doc) "A VIEW")) (setq SortIt (list) TabCount 0) ;; Alphabetize internally (while (>= (1- (vla-get-Count (vla-get-Layouts doc))) TabCount) (setq AddedTab :vlax-false) (setq TabName (vla-get-Name (vla-Item (vla-get-Layouts doc) TabCount))) (if (/= (strcase TabName) "MODEL") ;; Skip modelspace (progn (setq SortIt (append SortIt (list TabName))) ;; Add to beginning of list ) ) (setq TabCount (1+ TabCount)) ) ;; Sort layout names (setq SortIt (acad_strlsort SortIt) SortCount 1) ;; Update tab order (foreach name SortIt (progn (setq tempLayout (vla-Item (vla-get-Layouts doc) name)) (vla-put-TabOrder tempLayout SortCount) (setq SortCount (1+ SortCount)) ) ) ;;------------------------------- ;; Read and display New Tab Order ;;------------------------------- (setq msg "The tab order is now set to: \n" TabCount 0) (while (>= (1- (vla-get-Count (vla-get-Layouts doc))) TabCount) (setq TabName (vla-get-Name (vla-Item (vla-get-Layouts doc) TabCount))) (if (/= (strcase TabName) "MODEL") ;; Skip modelspace (progn (setq TabOrder (vla-get-TabOrder (vla-Item (vla-get-Layouts doc) TabCount))) (setq msg (strcat msg "(" (itoa TabOrder) ") " TabName "\n")) ) ) (setq TabCount (1+ TabCount)) ) (alert msg) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:50
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.