![]() |
#2
lowxiong2013-09-03 17:27
|

Option Explicit
Dim a, b As Single
Private Sub Command1_Click()
CommonDialog1.DialogTitle = "打开文件"
CommonDialog1.Action = 1
CommonDialog1.Filter = " All File (*.*) | *.*| JPG文件(.jpg)|*.jpg "
CommonDialog1.FilterIndex = 2
Image1.Stretch = True
Image1.Picture = LoadPicture(CommonDialog1.FileName)
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
'Image1.Stretch = True
'Image1.Picture = LoadPicture("d:\6.jpg")
a = Image1.Width / Form1.ScaleWidth
b = Image1.Height / Form1.ScaleHeight
End Sub
Private Sub Form_Resize()
Image1.Width = a * Form1.ScaleWidth
Image1.Height = b * Form1.ScaleHeight
End Sub
程序运行后,在第一次打开一个图片后,接着再一次打开时,却无法显示jpg的图片,这是怎么回事????Dim a, b As Single
Private Sub Command1_Click()
CommonDialog1.DialogTitle = "打开文件"
CommonDialog1.Action = 1
CommonDialog1.Filter = " All File (*.*) | *.*| JPG文件(.jpg)|*.jpg "
CommonDialog1.FilterIndex = 2
Image1.Stretch = True
Image1.Picture = LoadPicture(CommonDialog1.FileName)
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
'Image1.Stretch = True
'Image1.Picture = LoadPicture("d:\6.jpg")
a = Image1.Width / Form1.ScaleWidth
b = Image1.Height / Form1.ScaleHeight
End Sub
Private Sub Form_Resize()
Image1.Width = a * Form1.ScaleWidth
Image1.Height = b * Form1.ScaleHeight
End Sub
[ 本帖最后由 zhnzz4229 于 2013-9-2 20:12 编辑 ]