Dim l, t, w, h Private Sub Form_Load() Picture1.AutoSize = True Picture1.AutoRedraw = True Picture1.BackColor = vbBlack l = Picture1.Left / Me.Width t = Picture1.Top / Me.Height w = Picture1.Width / Me.Width h = Picture1.Height / Me.Height End SubPrivate Sub Form_Resize() With Picture1 .Left = l * Me.Width .Top = t * Me.Height .Width = w * Me.Width .Height = h * Me.Height End With End Sub
Dim l, t, w, h Private Sub Form_Load() Picture1.AutoSize = True Picture1.AutoRedraw = True Picture1.BackColor = vbBlack l = Picture1.Left / Me.Width t = Picture1.Top / Me.Height w = Picture1.Width / Me.Width h = Picture1.Height / Me.Height End SubPrivate Sub Form_Resize() With Picture1 .Left = l * Me.Width .Top = t * Me.Height .Width = w * Me.Width .Height = h * Me.Height End With Picture1.PaintPicture ImageList1.ListImages(1).Picture, 0, 0, Picture1.Width, Picture1.Height
Private Sub Form_Load()
Picture1.AutoSize = True
Picture1.AutoRedraw = True
Picture1.BackColor = vbBlack
l = Picture1.Left / Me.Width
t = Picture1.Top / Me.Height
w = Picture1.Width / Me.Width
h = Picture1.Height / Me.Height
End SubPrivate Sub Form_Resize()
With Picture1
.Left = l * Me.Width
.Top = t * Me.Height
.Width = w * Me.Width
.Height = h * Me.Height
End With
End Sub
Private Sub Form_Load()
Picture1.AutoSize = True
Picture1.AutoRedraw = True
Picture1.BackColor = vbBlack
l = Picture1.Left / Me.Width
t = Picture1.Top / Me.Height
w = Picture1.Width / Me.Width
h = Picture1.Height / Me.Height
End SubPrivate Sub Form_Resize()
With Picture1
.Left = l * Me.Width
.Top = t * Me.Height
.Width = w * Me.Width
.Height = h * Me.Height
End With
Picture1.PaintPicture ImageList1.ListImages(1).Picture, 0, 0, Picture1.Width, Picture1.Height
关键是
Picture1.PaintPicture ImageList1.ListImages(1).Picture, 0, 0, Picture1.Width, Picture1.Height
可使ImageList1中的图片刚好和图片框一样大.
Picture属性中没有,在代码中可以实现,设置图片符合图片框的大小...
Picture1.PaintPicture ImageList1.ListImages(1).Picture, 0, 0, Picture1.Width, Picture1.Height
方案二
用Image,这样在属性里就可以设置了...