Sub ResizePictureBoxToImage(pic as PictureBox, twipWd _
as Integer, twipHt as Integer)
'该代码假设所有的单位都为缇。如果
'不是,必须在调用该例程之前,转换为缇。
'这里也假设图象显示在0,0处。
Dim BorderHt as Integer, BorderWd as Integer
BorderWd = Pic.Width - Pic.ScaleWidth
BorderHt = Pic.Height - Pic.ScaleHeight
pic.Move pic.Left, pic.Top, twipWd + BorderWd, _
twipHt + BorderHt
End Sub