要怎样改,才能将转换前的图片停留在图片框内?那位能指点一下?
Private Sub Command1_Click()
On Error Resume Next
CommonDialog1.DialogTitle = "打开文件"
CommonDialog1.Filter = "所有支持的格式" + _
"(*.bmp;*.jpg;*.gif;*.pcx;*.ico)|" + _
"*.bmp;*.jpg;*.gif;*.pcx;*.ico)"
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
If Err <> 32755 Then
Dim OpenFileName As String
OpenFileName = CommonDialog1.FileName
Picture1.Picture = LoadPicture(OpenFileName)
End If
End If
End Sub
Private Sub Command2_Click()
On Error Resume Next
CommonDialog1.DialogTitle = "保存为BMP文件"
CommonDialog1.Filter = "位图文件(*.bmp)|*.bmp"
CommonDialog1.ShowSave
If CommonDialog1.FileName <> "" Then
If Err <> 32755 Then
Dim SaveBmpName As String
SaveBmpName = CommonDialog1.FileName
SavePicture Picture1.Image, SaveBmpName
End If
End If
End Sub
Private Sub Form_Load()
CommonDialog1.CancelError = True
End Sub