Vla-setcolor
- 構文
- (vla-setcolor vla-object rowTypes pColor )
- 機能
- 指定した行タイプの True Color 値を指定する。
- 引数
-
- vla-object … TableStyle の vla-object
- rowTypes … 変更する行タイプ。(AcRowType 列挙型)
- acDataRow
- acHeaderRow
- acTitleRow
- acUnknownRow
- pColor
- pColor … 行タイプに割り当てる AutoCAD True Color オブジェクト。(AcCmColor)
- 戻り値
- nil
- サンプル
(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) )
関連事項