'两个图片框,P1,P2.
'一个按钮Command1,
'P1要求ScaleWidth 为24 ScaleHeight也为24
Private Sub Command1_Click()
p1.AutoRedraw = True
P2.AutoRedraw = True
p1.PaintPicture LoadPicture("d:\a.bmp"), 0, 0
For x = 0 To p1.ScaleWidth * 2 '循环x,目的得到24*2 也就是48
For y = 0 To p1.ScaleHeight * 2 '循环y,目的得到24*2 也是48
xp1 = x
yp1 = y
If xp1 >= p1.ScaleWidth Then xp1 = xp1 - p1.ScaleWidth '如果横向xp1大于24,又从头开始
If yp1 >= p1.ScaleHeight Then yp1 = yp1 - p1.ScaleHeight '如果纵向yp1大于24,又从头开始
P2.PSet (x, y), p1.Point(xp1, yp1) '设置P2对应的像素点
Next y
Next x
SavePicture P2.Image, "D:\b.bmp" '保存文件
End Sub