Vla-getbackgroundcolor

提供:GizmoLabs - だいたい CAD LISP なサイト
2015年7月5日 (日) 16:53時点におけるGizmon (トーク | 投稿記録)による版 (ページの作成:「{{AutoLISP}} ; 構文 : (vla-getbackgroundcolor ''vla-object'' ''rowTypes'') ; 機能 : 指定した行タイプの背景色の値を返す。 ; 引数 :* vla-object...」)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
構文
(vla-getbackgroundcolor vla-object rowTypes)


機能
指定した行タイプの背景色の値を返す。


引数
  • vla-object … TableStyle の vla-object
  • rowTypes … 変更する行タイプ。(AcRowType 列挙型)
  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow


戻り値
行タイプの背景色に割り当てられている AutoCAD True Color オブジェクト。


サンプル
(vl-load-com)
(defun c:Example_SetColor()
    ;; 表スタイルを作成して各種の色をセットするサンプル
    (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"))
    
    ;; 現在の表スタイルを取得
    (setq tableStyle (vla-Item dictObj (vla-GetVariable doc "CTABLESTYLE")))
      
    (setq colCurrent (vla-GetBackgroundColor tableStyle (+ acDataRow acTitleRow)))
    (setq colRowCurrent (vla-GetColor tableStyle acDataRow))
    (setq colNoneCurrent (vla-GetBackgroundColorNone tableStyle acHeaderRow))

    (alert (strcat "表の色 \n"
                   "背景の ACI 値 = " (itoa (vla-get-ColorIndex colCurrent)) "\n"
                   "行の文字 ACI 値 = " (itoa (vla-get-ColorIndex colRowCurrent)) "\n"
                   "背景なし = " (if (= colNoneCurrent :vlax-true) "True" "False")))
  
    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 0 0 255)
    (vla-SetBackgroundColor tableStyle acTitleRow col)
    (vla-SetRGB col 255 0 0)
    (vla-SetColor tableStyle acDataRow col)
    (vla-SetBackgroundColorNone tableStyle acHeaderRow (if (= colNoneCurrent :vlax-true) :vlax-false :vlax-true))
  
    (setq colNew (vla-GetBackgroundColor tableStyle acTitleRow))
    (setq colRowNew (vla-GetColor tableStyle acDataRow))
    (setq colNoneNew (vla-GetBackgroundColorNone tableStyle acHeaderRow))
    (alert (strcat "表の色 \n"
                   "背景の ACI 値 = " (itoa (vla-get-ColorIndex colNew)) "\n"
                   "行の文字 ACI 値 = " (itoa (vla-get-ColorIndex colRowNew)) "\n"
                   "背景なし = " (if (= colNoneNew :vlax-true) "True" "False")))

    (vla-SetBackgroundColor tableStyle acTitleRow colCurrent)
    (vla-SetColor tableStyle acDataRow colRowCurrent)
    (vla-SetBackgroundColorNone tableStyle acHeaderRow colNoneCurrent)

    (alert "表スタイルの値をリセット。")

    (vlax-release-object col)
)


関連事項