Private Sub Command1_Click()
'模拟读入一个图片
Picture1.Picture = LoadPicture("c:\windows\FeatherTexture.bmp")
Dim i As Single
'计算比例
Dim j As Single
Dim x As Single
'图片居中用的坐标
Dim y As Single
i = (Picture2.Width) / Picture1.Width
'计算各自缩放比例
j = (Picture2.Height) / Picture1.Height
If i > j Then i = j
'取最小的那个方向的比例
x = (Picture2.Width - Picture1.Width * i) / 2
'计算居中的坐标
y = (Picture2.Height - Picture1.Height * i) / 2
'复制图片,按比例进行缩放
Picture2.PaintPicture Picture1.Picture, x, y, Picture1.Width * i, Picture1.Height * i
End Sub