ImageHeight 屬性

此頁沒有內(nèi)容條目
內(nèi)容

expandtri全部顯示

Visual Basic 中,使用 ImageHeight 屬性可以決定圖像控件中以為單位的圖像高度。Long 型,可讀寫。

expression.ImageHeight

expression     必需。返回“應(yīng)用于”列表中的一個對象的表達(dá)式。

說明

ImageHeight 屬性是一個 Integer 值,該值等于圖片以緹為單位的高度值。

該屬性在所有視圖中都是只讀的。

ImageHeight 屬性與 ImageWidth 屬性一起使用,可以決定圖像控件中圖片的大小,并可使用該信息更改圖像控件的 HeightWidth 屬性,以調(diào)整控件使之能夠與所顯示的圖片大小相匹配。

示例

下面的示例提示用戶輸入位圖文件名,然后將該位圖文件指定給 Image1 圖像控件的 Picture 屬性。ImageHeightImageWidth 屬性則用于將圖像控件調(diào)整到適合位圖的大小。

Sub GetNewPicture(frm As Form)

    Dim ctlImage As Control

    Set ctlImage = frm!Image1

    ctlImage.Picture = InputBox("Enter path and " _

        & "file name for new bitmap")

    ctlImage.Height = ctlImage.ImageHeight

    ctlImage.Width = ctlImage.ImageWidth

End Sub