Foxtable(狐表)用户栏目专家坐堂 → [求助]递归函数返回不了正确的值?


  共有1864人关注过本帖树形打印复制链接

主题:[求助]递归函数返回不了正确的值?

帅哥哟,离线,有人找我吗?
有点色
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/5/15 14:16:00 [显示全部帖子]

 你想实现什么?没看懂你代码的意思

 

Dim width As Integer = args(0)  '模板宽度
Dim height As Integer = args(1)    '模板高度
Dim ImagePath As String = args(2)   '图片文件
Dim iSource As Image = getimage(ImagePath)
Dim ob As Bitmap = new Bitmap(width , height )
Dim g As  Graphics  = Graphics.FromImage(ob)
g.Clear(Color.WhiteSmoke)
g.DrawImage(iSource, new Rectangle(0,0, width , height ), 0, 0, iSource.Width, iSource.Height, GraphicsUnit.Pixel)
Dim dFile As String  = "g:\test.jpg"
ob.Save(dFile)
Application.DoEvents()

Dim Info As new FileInfo(dFile)
Dim len As Integer = info.Length
width = width - 100
height = height - 100
Dim result As Boolean
If len < 204800         '判断图片大小是否大于200KB
    result = True    '返回不了这个TRUE
Else
    Vars("RecursiveCount") += 1  '测试记录一下递归次数
    result = result OrElse Functions.Execute("ImageCompress",width,height ,ImagePath)   '递归
End If

iSource.Dispose()
ob.Dispose()
g.Dispose()
Return result


 回到顶部