SetGridVisibility メソッド(ActiveX)

指定した罫線の線種と行タイプの罫線の表示設定値を設定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.SetGridVisibility gridLineTypes, rowTypes, bValue
object

タイプ: TableTableStyle

このメソッドが適用されるオブジェクト。

gridLineTypes

アクセス: 入力のみ

タイプ: AcGridLineType 列挙型

変更する罫線の線種。

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight
rowTypes

アクセス: 入力のみ

タイプ: AcRowType 列挙型

変更する行タイプ。

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow
bValue

アクセス: 入力のみ

タイプ: ブール型

  • True: 罫線は指定した行タイプに対して表示されます。
  • False: 罫線は指定した行タイプに対して表示されません。

戻り値(RetVal)

戻り値はありません。

注意

追加の注意はありません。

VBA:

Sub Example_SetGridVisibility()
    ' 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")
  
    ' Get the current TableStyle object
    Dim tableStyle As AcadTableStyle
    Set tableStyle = dictObj.Item(ThisDrawing.GetVariable("CTABLESTYLE"))
  
    Dim colGridCurrent As AcadAcCmColor, lwGridCurrent As ACAD_LWEIGHT, visGridCurrent As Boolean
    Set colGridCurrent = tableStyle.GetGridColor(acHorzBottom, acTitleRow)
    lwGridCurrent = tableStyle.GetGridLineWeight(acHorzBottom, acTitleRow)
    visGridCurrent = tableStyle.GetGridVisibility(acHorzTop, acTitleRow)

    MsgBox "Grid settings " & vbLf & _
           "nColor (Bottom) = " & colGridCurrent.ColorIndex & vbLf & _
           "nLineweight (Bottom) = " & lwGridCurrent & vbLf & _
           "Visibility (Top) =  " & visGridCurrent
  
    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 0, 0, 255

    tableStyle.SetGridColor acHorzBottom, acTitleRow, col
    tableStyle.SetGridLineWeight acHorzBottom, acTitleRow, acLnWt025

    If visGridCurrent = False Then
        tableStyle.SetGridVisibility acHorzTop, acTitleRow, True
    Else
        tableStyle.SetGridVisibility acHorzTop, acTitleRow, False
    End If
      
    Dim colGridNew As AcadAcCmColor, lwGridNew As ACAD_LWEIGHT, visGridNew As Boolean
    Set colGridNew = tableStyle.GetGridColor(acHorzBottom, acTitleRow)
    lwGridNew = tableStyle.GetGridLineWeight(acHorzBottom, acTitleRow)
    visGridNew = tableStyle.GetGridVisibility(acHorzTop, acTitleRow)

    MsgBox "Grid settings " & vbLf & _
           "nColor (Bottom) = " & colGridNew.ColorIndex & vbLf & _
           "nLineweight (Bottom) = " & lwGridNew & vbLf & _
           "Visibility (Top) =  " & visGridNew
             
    tableStyle.SetGridColor acHorzBottom, acTitleRow, colGridCurrent
    tableStyle.SetGridLineWeight acHorzBottom, acTitleRow, lwGridCurrent
    tableStyle.SetGridVisibility acHorzTop, acTitleRow, visGridCurrent
      
    MsgBox "Reset the table style back to its original values."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetGridVisibility()
    ;; This example creates a TableStyle object and sets values for 
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
  
    (setq dictionaries (vla-get-Dictionaries doc))
    (setq 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 (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)
  
    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetBackgroundColorNone customObj acHeaderRow :vlax-false)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) 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")
	          )
    )
    (vlax-release-object col)
)