CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2025 开发者帮助

HorzCellMargin 属性 (ActiveX)

2024-5-18 19:21| 发布者: admin| 查看: 104| 评论: 0|原作者: admin|来自: AutoCAD

HorzCellMargin 属性 (ActiveX)

指定单元格水平边距的值。

支持的平台:仅限 Windows

签名

VBA:

object.HorzCellMargin
对象

类型:TableTableStyle

此属性应用于的对象。

属性值

只读:

类型:

应用于每个表格单元格的水平边距。

言论

没有其他评论。

例子

VBA:

Sub Example_HorzCellMargin()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.
    
    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries
  
    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")
  
    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)
      
    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"
  
    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight acTitleRow, 1.3
    customObj.SetTextHeight acHeaderRow, 1
    customObj.SetTextHeight acDataRow, 1
    customObj.SetTextStyle acTitleRow, "Standard"
    customObj.SetTextStyle acHeaderRow, "Standard"
    customObj.SetTextStyle acDataRow, "Standard"
  
    Dim col As AcadAcCmColor
    Set col = customObj.GetBackgroundColor(acTitleRow)
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor acTitleRow, col
    customObj.SetGridVisibility acHorzInside + acHorzTop, acTitleRow, True
    customObj.SetGridVisibility acHorzInside + acHorzTop, acHeaderRow, True
    customObj.SetGridVisibility acHorzInside + acHorzTop, acDataRow, True
    customObj.SetAlignment acTitleRow, acBottomRight
    customObj.SetAlignment acHeaderRow, acBottomCenter
    customObj.SetAlignment acDataRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor acHorzInside + acHorzTop, acDataRow, col
      
    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed
End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_HorzCellMargin()
    ;; This example creates a TableStyle object and sets values for 
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object)
          doc (vla-get-ActiveDocument acadObj))
  
    (setq dictionaries (vla-get-Dictionaries doc)
          dictObj (vla-Item dictionaries "acad_tablestyle"))
    
    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")
  
    (setq customObj (vla-AddObject dictObj keyName className))
      
    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")
  
    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj acTitleRow 1.3)
    (vla-SetTextHeight customObj acHeaderRow 1)
    (vla-SetTextHeight customObj acDataRow 1)
    (vla-SetTextStyle customObj acTitleRow "Standard")
    (vla-SetTextStyle customObj acHeaderRow "Standard")
    (vla-SetTextStyle customObj acDataRow "Standard")

    (setq col (vla-GetBackgroundColor customObj acTitleRow))
    (vla-SetRGB col 12 23 45)
  
    (vla-SetBackgroundColor customObj acTitleRow col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) acTitleRow :vlax-true)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) acHeaderRow :vlax-true)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) acDataRow :vlax-true)
    (vla-SetAlignment customObj acTitleRow acBottomRight)
    (vla-SetAlignment customObj acHeaderRow acBottomCenter)
    (vla-SetAlignment customObj acDataRow acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)
      
    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
                   "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
           )
    )
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1   苏公网安备32011402011833)

GMT+8, 2024-12-15 13:12

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部