界面固定后,picture不能显示全部图片,怎么办?
两个方法:
1、在picture中再加入一个image,调整大小与picture一样,将image的stretch的属性设置为真.
这样图片在image的强制下,正好与picture一样大。
2、同样在picture中加入image,但把stretch设置为假。即原样图。移动image可以在picture中看到原样。
这样图像不会失真。
看下第二个方法:
Option Explicit
Dim oldX As Long
Dim oldY As Long
Private Sub Form_Load()
Image1.Picture = LoadPicture("D:\1.jpg")
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbKeyLButton Then
oldX = X
oldY = Y
Me.MousePointer = 2
End If
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbKeyLButton Then
Image1.Left = Image1.Left + (X - oldX)
Image1.Top = Image1.Top + (Y - oldY)
End If
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbKeyLButton Then
Me.MousePointer = 0
End If
End Sub