'=========================qqq是一个照片的路径参数==============================
Private Sub jjj(qqq As String)'错误处理(如果没有照片则跳转处理函数)
On Error GoTo DealErrorSet a = LoadPicture(qqq)
If a.Height / Picture1.ScaleHeight < a.Width / Picture1.ScaleWidth Then
p = Picture1.ScaleWidth / a.Width
Picture1.PaintPicture a, 0, (Picture1.ScaleHeight - a.Height * p) * 0.5, Picture1.ScaleWidth, p * a.Height
Else
p = Picture1.ScaleHeight / a.Height
Picture1.PaintPicture a, (Picture1.ScaleWidth - a.Width * p) * 0.5, 0, p * a.Width, Picture1.ScaleHeight
End If
DealError:
qqq = App.Path & "\模版照片\1.jpg"
MsgBox "修复成功,可以显示图片了", , "系统自动修复"
'在跳回到错误处运行
Resume
End Sub这个程序写了以后,会不停地弹出修复成功的提示,证明错误一直存在,形成了死循环,请高手指点我快没分了都,呜呜。
Private Sub jjj(qqq As String)'错误处理(如果没有照片则跳转处理函数)
On Error GoTo DealErrorSet a = LoadPicture(qqq)
If a.Height / Picture1.ScaleHeight < a.Width / Picture1.ScaleWidth Then
p = Picture1.ScaleWidth / a.Width
Picture1.PaintPicture a, 0, (Picture1.ScaleHeight - a.Height * p) * 0.5, Picture1.ScaleWidth, p * a.Height
Else
p = Picture1.ScaleHeight / a.Height
Picture1.PaintPicture a, (Picture1.ScaleWidth - a.Width * p) * 0.5, 0, p * a.Width, Picture1.ScaleHeight
End If
DealError:
qqq = App.Path & "\模版照片\1.jpg"
MsgBox "修复成功,可以显示图片了", , "系统自动修复"
'在跳回到错误处运行
Resume
End Sub这个程序写了以后,会不停地弹出修复成功的提示,证明错误一直存在,形成了死循环,请高手指点我快没分了都,呜呜。
On Error GoTo DealError Set a = LoadPicture(qqq)
If a.Height / Picture1.ScaleHeight < a.Width / Picture1.ScaleWidth Then
p = Picture1.ScaleWidth / a.Width
Picture1.PaintPicture a, 0, (Picture1.ScaleHeight - a.Height * p) * 0.5, Picture1.ScaleWidth, p * a.Height
Else
p = Picture1.ScaleHeight / a.Height
Picture1.PaintPicture a, (Picture1.ScaleWidth - a.Width * p) * 0.5, 0, p * a.Width, Picture1.ScaleHeight
End If
Exit Sub
DealError:
qqq = App.Path & "\模版照片\1.jpg"
MsgBox "修复成功,可以显示图片了", , "系统自动修复"
'在跳回到错误处运行
Resume Next
End Sub
Private Sub jjj(qqq As String)
'错误处理
On Error GoTo DealError
Set a = LoadPicture(qqq)
If a.Height / Picture1.ScaleHeight < a.Width / Picture1.ScaleWidth Then
p = Picture1.ScaleWidth / a.Width
Picture1.PaintPicture a, 0, (Picture1.ScaleHeight - a.Height * p) * 0.5, Picture1.ScaleWidth, p * a.Height
Else
p = Picture1.ScaleHeight / a.Height
Picture1.PaintPicture a, (Picture1.ScaleWidth - a.Width * p) * 0.5, 0, p * a.Width, Picture1.ScaleHeight
End If
Exit Sub
DealError:
MsgBox "检测到会员图片丢失,系统开始自我修复", , "系统提示"
Dim abc, def As String
abc = App.Path & "\照片\" & t1.Text & "-" & T4.Text & ".jpg"
def = App.Path & "\模版照片\1.jpg"
FileCopy def, abc
MsgBox "系统自我修复成功", , "修复成功"
qqq = App.Path & "\模版照片\1.jpg"
'在跳回到错误处运行,不能Resume Next因为我还要处理那个错误的语句
Resume
End Sub'=========================感谢大家的支持,我一直忽略了exit sub ==================
Resume