ImageHeight プロパティ(ActiveX)

ラスター イメージの高さを指定します。

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

構文と要素

VBA:

object.ImageHeight
object

タイプ: GeomapImageRasterImageWipeout

このプロパティが適用されるオブジェクト。

プロパティの値

読み込み専用: いいえ

タイプ: 倍精度浮動小数点数型

ラスター イメージの高さ

注意

このプロパティは Height プロパティに似ています。Height プロパティは、イメージの高さをピクセル単位で指定します。このプロパティは、イメージの高さを現在の単位で指定します。

VBA:

Sub Example_ImageHeight()
    ' This example adds a raster image in model space and then finds
    ' the height and width of the image.
    
    ' This example uses the "2d Projected Polylines.jpg" found in the Sample
    ' directory. If you do not have this image, or if it is located
    ' in a different directory, insert a valid path and file name
    ' for the imageName variable below.
    
    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotationAngle As Double
    Dim imageName As String
    Dim rasterObj As AcadRasterImage
    imageName = "C:/AutoCAD/sample/2d Projected Polylines.jpg"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0#
    scalefactor = 1#
    rotationAngle = 0
    
    ' Creates a raster image in model space
    Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotationAngle)
    
    ' Find the height and width of the raster image
    Dim height As Variant
    Dim width As Variant
    
    height = rasterObj.ImageHeight
    width = rasterObj.ImageWidth
    
    MsgBox "Raster image: " & rasterObj.ImageFile & vbCrLf & _
           "ImageHeight: " & Str(height) & vbCrLf & _
           "ImageWidth: " & Str(width)
            
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ImageHeight()
    ;; This example adds a raster image in model space and then finds
    ;; the height and width of the image.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; This example uses the "2d Projected Polylines.jpg" found in the Sample
    ;; directory. If you do not have this image, or if it is located
    ;; in a different directory, insert a valid path and file name
    ;; for the imageName variable below.
    (setq insertionPoint (vlax-3d-point 5 5 0)  
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 1
          rotationAngle 0)
    
    ;; Creates a raster image in model space
    (if (/= (findfile imageName) nil)
        (progn
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq rasterObj (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotationAngle))
    
	    ;; Find the height and width of the raster image
	    (setq height (vla-get-ImageHeight rasterObj)
	          width (vla-get-ImageWidth rasterObj))
	    
	    (alert (strcat "Raster image: " (vla-get-ImageFile rasterObj)
	                   "\nImageHeight: " (rtos height 2)
	                   "\nImageWidth: " (rtos width 2)))
        )
        (alert (strcat imageName " could not be found."))
    )
)