标题:请教关于图片显示更换
只看楼主
cjc1010
Rank: 3Rank: 3
等 级:论坛游侠
威 望:4
帖 子:64
专家分:195
注 册:2006-4-16
得分:0 
直接
 apic=getfile()
 thisform.image1.picture=paic
就行了,随时换,哪来那么多的事。
2022-02-15 11:16
wxzd123
Rank: 2
等 级:论坛游民
帖 子:238
专家分:43
注 册:2012-9-6
得分:0 
今天又出现原来的图片没有被删除,新的图片没有拷贝过来,仍然显示原来的图片?请问各位老师有什么好的办法?谢谢
2022-02-16 16:16
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:432
帖 子:10064
专家分:41463
注 册:2014-5-20
得分:0 
回复 12楼 wxzd123
试试用 PictureVal 属性
如:
op = LOADPICTURE(bmpFile)
image1.PictureVal = op
2022-02-16 18:32
wxzd123
Rank: 2
等 级:论坛游民
帖 子:238
专家分:43
注 册:2012-9-6
得分:0 
谢谢版主,这个加载时间是原来的5倍还多
2022-02-16 19:02
wxzd123
Rank: 2
等 级:论坛游民
帖 子:238
专家分:43
注 册:2012-9-6
得分:0 
原来用Delete File 删除不是每次都不好用是有时,现在改ERASE再试试
2022-02-16 19:04
wxzd123
Rank: 2
等 级:论坛游民
帖 子:238
专家分:43
注 册:2012-9-6
得分:0 
我把界面最小化后在文件中直接删除不了,提示在使用,请问怎么解决?谢谢
2022-02-16 22:53
wxzd123
Rank: 2
等 级:论坛游民
帖 子:238
专家分:43
注 册:2012-9-6
得分:0 
每次都有e.png删不掉,我遍历表单上的所有控件没有加载图片的控件
2022-02-16 23:13
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:432
帖 子:10064
专家分:41463
注 册:2014-5-20
得分:0 
给相关文件测试好了
2022-02-17 04:24
wxzd123
Rank: 2
等 级:论坛游民
帖 子:238
专家分:43
注 册:2012-9-6
得分:0 
回复 18楼 吹水佬
您好,现在找到了使用图片代码,我在表单中新建了一个方法程序hbtp
hbtp下的代码:
Declare Long GetDC In user32 Long
Declare Long ReleaseDC In user32 Long, Long
Declare Long GdiplusStartup In GDIPlus Long@, String@, Long
Declare Long GdiplusShutdown In GDIPlus Long
Declare Long GdipCreateBitmapFromScan0 In GDIPlus Long, Long, Long, Long, String@, Long@
Declare Long GdipGetImageGraphicsContext In GDIPlus Long, Long@
Declare Long GdipCreateFromHDC In GDIPlus Long, Long@
Declare Long GdipLoadImageFromFile In GDIPlus String@, Long@
Declare Long GdipGetImageWidth In GDIPlus Long, Long@
Declare Long GdipGetImageHeight In GDIPlus Long, Long@
Declare Long GdipSaveImageToFile In GDIPlus Long, String@, String@, Long
Declare Long GdipDrawImageRectI In GDIPlus Long, Long, Long, Long, Long, Long
Declare Long GdipDisposeImage In GDIPlus Long
Declare Long GdipDeleteGraphics In GDIPlus Long
outFile = "合并.png"
wjm='abcde'
inFile1='.\临时\'+Left(wjm,1)+'.png'
IF !FILE(inFile1)
retu
endif
stGSI = 0h01000000000000000000000000000000
pGDI = 0
GdiplusStartup(@pGDI, @stGSI, 0)
pImage1 = 0
GdipLoadImageFromFile(Strconv(inFile1+0h00,5), @pImage1)         
nWidth1 = 0
GdipGetImageWidth(pImage1, @nWidth1)
nHeight1 = 0
GdipGetImageHeight(pImage1, @nHeight1)
N=Len(wjm)
nWidth = nWidth1*N                 
nHeight = nHeight1                 
PixelFormat_32bppARGB = 0x26200A
pBitmap = 0
GdipCreateBitmapFromScan0(nWidth, nHeight, 0, PixelFormat_32bppARGB, 0, @pBitmap)

pGraphics = 0
GdipGetImageGraphicsContext(pBitmap, @pGraphics)
GdipDrawImageRectI(pGraphics, pImage1, 0, 0, nWidth1, nHeight1)   
For i=2 To N
    inFile2='.\临时\'+Substr(wjm,i,1)++Right(m_dx,4)
    IF FILE(inFile2)
    pImage2 = 0
    GdipLoadImageFromFile(Strconv(inFile2+0h00,5), @pImage2)  
    ii=nWidth1*(i-1)
    GdipDrawImageRectI(pGraphics, pImage2, ii, 0, nWidth1, nHeight1)  
    endif
Endfor
CLSID_BMP = 0h00F47C55041AD3119A730000F81EF32E
GdipSaveImageToFile(pBitmap, Strconv(outFile+0h00,5), CLSID_BMP, 0)  
GdipDisposeImage(pImage1)
GdipDisposeImage(pImage2)
GdipDeleteGraphics(pGraphics)
GdipDisposeImage(pBitmap)
GdiplusShutdown(pGDI)

pImage = 0
GdipLoadImageFromFile(Strconv(outFile+0h00,5), @pImage)
hDC = GetDC(_Screen.HWnd)
pGraphics = 0
GdipCreateFromHDC(hDC, @pGraphics)
GdipDrawImageRectI(pGraphics, pImage, 10, 10, 500, 500*nHeight/nWidth)
GdipDisposeImage(pImage)
GdipDeleteGraphics(pGraphics)
ReleaseDC(_Screen.HWnd, hDC)
是把文件夹下图片合并成一个图片,这些代码是网上找的也不明白,只是做了些修改。
执行thisform.hbtp后图片被占用不能删除,请问老师如何释放掉?谢谢

[此贴子已经被作者于2022-2-17 06:30编辑过]

2022-02-17 06:28
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:432
帖 子:10064
专家分:41463
注 册:2014-5-20
得分:0 
回复 19楼 wxzd123
pImage2 = 0  &&加这句
For i=2 To N
    inFile2='.\临时\'+Substr(wjm,i,1)++Right(m_dx,4)
    IF FILE(inFile2)
        pImage2 = 0
        GdipLoadImageFromFile(Strconv(inFile2+0h00,5), @pImage2)  
        ii=nWidth1*(i-1)
        GdipDrawImageRectI(pGraphics, pImage2, ii, 0, nWidth1, nHeight1)
        GdipDisposeImage(pImage2)  &&加这句试试
    endif
Endfor


[此贴子已经被作者于2022-2-17 06:54编辑过]

2022-02-17 06:49



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-508347-1-1.html




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

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