| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1594 人关注过本帖
标题:过程怎么返回两个值?
只看楼主 加入收藏
baichuan
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:37
帖 子:953
专家分:589
注 册:2006-3-13
结帖率:93.55%
收藏
已结贴  问题点数:20 回复次数:9 
过程怎么返回两个值?
function testjpg(a,nwidth,nheight)
lcImageName=a
Declare Integer GdipLoadImageFromFile In GDIPlus.Dll String wFilename, Integer @nImage
Declare Integer GdipGetImageWidth In GDIPlus Integer img,Integer @ imgwidth
Declare Integer GdipGetImageHeight In GDIPlus Integer img,Integer @ imgheight
Declare Integer GdipDisposeImage In GDIPlus.Dll Long nativeImage
Store 0 To nImage,nWidth,nHeight
GdipLoadImageFromFile(Strconv(lcImageName+Chr(0),5),@nImage)
GdipGetImageWidth(nImage,@nWidth)
GdipGetImageHeight(nImage,@nHeight)
GdipDisposeImage(nImage)
return nWidth
return nHeight
endfunction

我使用的时候是这样的
testjpg(getfile("jpg"),nw,nh)
?nw
?nh
哪里不对呢?
搜索更多相关主题的帖子: function 
2016-07-29 13:54
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:451
帖 子:10543
专家分:42934
注 册:2014-5-20
收藏
得分:0 
nw = 0
nh = 0
testjpg(getfile("jpg"), @nw, @nh)
?nw
?nh
2016-07-29 13:59
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:451
帖 子:10543
专家分:42934
注 册:2014-5-20
收藏
得分:10 
return nWidth
return nHeight &&这句有效吗?
这两句不要
2016-07-29 14:01
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9803
专家分:26913
注 册:2012-2-5
收藏
得分:0 
clear
local nw,nh
testjpg(getfile("jpg"),@nw,@nh)
?nw,nh
function testjpg(a,nwidth,nheight)
lcImageName=a
Declare Integer GdipLoadImageFromFile In GDIPlus.Dll String wFilename, Integer @nImage
Declare Integer GdipGetImageWidth In GDIPlus Integer img,Integer @ imgwidth
Declare Integer GdipGetImageHeight In GDIPlus Integer img,Integer @ imgheight
Declare Integer GdipDisposeImage In GDIPlus.Dll Long nativeImage
Store 0 To nImage,nWidth,nHeight
GdipLoadImageFromFile(Strconv(lcImageName+Chr(0),5),@nImage)
GdipGetImageWidth(nImage,@nWidth)
GdipGetImageHeight(nImage,@nHeight)
GdipDisposeImage(nImage)
endfunc

坚守VFP最后的阵地
2016-07-29 14:20
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9803
专家分:26913
注 册:2012-2-5
收藏
得分:10 
*获取图像文件的宽和高(像素)
cImg = Getpict()   && 获取 bmp, jpg, gif  
   
xImgObj = LoadPicture(cImg)  
With xImgObj  
    lnWidth = Int(.Width/26.458)  
    lnHeight = Int(.Height/26.458)  
Endwith  
   
Messagebox("宽度 = " + Transform(lnWidth) + "(像数)" + Chr(13) + ;  
    "高度 = " + Transform(lnHeight) + "(像数)")

坚守VFP最后的阵地
2016-07-29 14:26
baichuan
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:37
帖 子:953
专家分:589
注 册:2006-3-13
收藏
得分:0 
以下是引用吹水佬在2016-7-29 14:01:13的发言:

return nWidth
return nHeight &&这句有效吗?
这两句不要

不需要return啊?

2016-07-29 15:09
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:451
帖 子:10543
专家分:42934
注 册:2014-5-20
收藏
得分:0 
op = CREATEOBJECT("Image")
op.Picture = GETPICT()
? "Width  : ", op.Width
? "Height : ", op.Height
2016-07-29 15:12
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9803
专家分:26913
注 册:2012-2-5
收藏
得分:0 
回复 7楼 吹水佬

坚守VFP最后的阵地
2016-07-29 15:36
mywisdom88
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:191
帖 子:3146
专家分:8408
注 册:2015-3-25
收藏
得分:0 
以下是引用吹水佬在2016-7-29 15:12:42的发言:

op = CREATEOBJECT("Image")
op.Picture = GETPICT()
? "Width  : ", op.Width
? "Height : ", op.Height

这么简单。。。
2016-07-29 16:17
aaaaaa
Rank: 8Rank: 8
等 级:贵宾
威 望:21
帖 子:796
专家分:937
注 册:2012-9-4
收藏
得分:0 
5 楼的化简也可以这么简单:

xImgObj = LoadPicture(Getpict())
? "宽度 : ", Int(xImgObj.Width/26.458)
? "高度 : ", Int(xImgObj.Height/26.458)

民工子弟学校22班团小组长阳光模特队长冲锋篮球队前锋小苹果合唱队领唱蓝天舞蹈队编舞
2016-07-29 16:59
快速回复:过程怎么返回两个值?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018058 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved