找回密码
 加入
搜索
查看: 4248|回复: 8

[GUI管理] 【已解决】为何用_GDIPlus_ImageGetWidth取得图片宽度后图片不能显示

  [复制链接]
发表于 2011-1-11 10:19:16 | 显示全部楼层 |阅读模式
本帖最后由 xuzhenjun130 于 2011-1-11 12:06 编辑
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>

$Form1 = GUICreate("Form1", 623, 449, 192, 114)
_GDIPlus_Startup ()
$Image = _GDIPlus_ImageLoadFromFile (@DesktopDir & "\test.jpg")
$w=_GDIPlus_ImageGetWidth($Image) ;图片宽
$h=_GDIPlus_ImageGetHeight($Image) ;图片高
_GDIPlus_ShutDown ()
$Pic1 = GUICtrlCreatePic(@DesktopDir & "\test.jpg", 64, 24, $w, $h) 
;即使在这里去掉$w,$h,填别的数字,图片也不能显示
GUISetState(@SW_SHOW)


While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd
当下面这段代码存在时,这里
$Pic1 = GUICtrlCreatePic(@DesktopDir & "\test.jpg", 64, 24, $w, $h)
怎么改图片的高和宽,都不能显示,除了填0
_GDIPlus_Startup ()

$Image = _GDIPlus_ImageLoadFromFile (@DesktopDir & "\test.jpg")

$w=_GDIPlus_ImageGetWidth($Image) ;图片宽

$h=_GDIPlus_ImageGetHeight($Image) ;图片高

_GDIPlus_ShutDown ()
很无语啊
发表于 2011-1-11 10:55:36 | 显示全部楼层
帮顶 确实无语 等老潇
发表于 2011-1-11 11:20:38 | 显示全部楼层
估计是_GDIPlus_ImageLoadFromFile使用了独占模式,你调用完之后deleteobject试试。
 楼主| 发表于 2011-1-11 11:35:02 | 显示全部楼层
本帖最后由 xuzhenjun130 于 2011-1-11 11:36 编辑

回复 3# republican
deleteobject具体删除除哪个object?能讲详细点吗? 不知道怎么样操作,有deleteobject之类的函数?
发表于 2011-1-11 11:41:34 | 显示全部楼层
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>

$Form1 = GUICreate("Form1", 623, 449, 192, 114)
_GDIPlus_Startup ()
$Image = _GDIPlus_ImageLoadFromFile (@DesktopDir & "\test.jpg")
$w=_GDIPlus_ImageGetWidth($Image) ;图片宽
$h=_GDIPlus_ImageGetHeight($Image) ;图片高
_GDIPlus_ImageDispose($Image);应该要先释放图像对象吧
_GDIPlus_ShutDown ()
$Pic1 = GUICtrlCreatePic(@DesktopDir & "\test.jpg", 64, 24, $w, $h) 
;即使在这里去掉$w,$h,填别的数字,图片也不能显示
GUISetState(@SW_SHOW)


While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd
 楼主| 发表于 2011-1-11 12:04:55 | 显示全部楼层
回复 5# 3mile

谢谢,这问题纠结了很久
发表于 2011-1-11 22:29:19 | 显示全部楼层
哦 学习了
发表于 2011-2-6 22:04:34 | 显示全部楼层
回复 5# 3mile


    谢谢啊, 我也纠结了好久
发表于 2013-3-26 10:15:30 | 显示全部楼层
3Q 5# 找到答案了!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-1 10:38 , Processed in 0.073241 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表