In order to compare the Height/Width properties of the PictureBox and the Picture, you need to ensure they are using the same unit of measurement.
The values of the PictureBox.Picture.Height/Width properties are in HiMetric units.
For comparison, use the values of the PictureBox.ScaleHeight/ScaleWidth properties which are in the ScaleMode of the PictureBox.
Code:Dim lngHeight As Long Dim lngWidth As Long lngHeight = Picture1.ScaleY(Picture1.Picture.Height, vbHimetric, Picture1.ScaleMode) lngWidth = Picture1.ScaleX(Picture1.Picture.Height, vbHimetric, Picture1.ScaleMode) If lngHeight > Picture1.ScaleHeight Or lngWidth > Picture1.ScaleWidth Then




Reply With Quote