找回密码
 加入
搜索
查看: 2609|回复: 5

[AU3基础] 如何清空GUICtrlSetImage图片后插入大小不一的图片,图片框不变,谢谢!(已解决)

[复制链接]
发表于 2014-5-21 10:26:58 | 显示全部楼层 |阅读模式
本帖最后由 cfs43210 于 2014-5-21 22:04 编辑
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 445, 192, 124)
$Button1 = GUICtrlCreateButton("插入", 144, 272, 145, 73)
$Pic1 = GUICtrlCreatePic("", 128, 24, 337, 185)
$Button2 = GUICtrlCreateButton("清空", 336, 272, 153, 81)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        $var = FileOpenDialog("浏览照片", @MyDocumentsDir & "", "图像文件 (*.jpg;*.bmp)", 1 + 4)
                        GUICtrlSetImage($Pic1, $var)

                Case $Button2
                        GUICtrlSetImage($Pic1, "") ;清空图片
                        GUICtrlSetResizing($Pic1, $GUI_DOCKSIZE)

        EndSwitch

WEnd
GUICtrlSetImage加载的图片如何清空,谢谢!!
GUICtrlSetImage($Pic1, "")
这样可以清空图片,但加载不同大小的图片时,图片框会随图片大小而变化.
 楼主| 发表于 2014-5-21 20:33:42 | 显示全部楼层
自已顶一顶,希望有人帮我解答,谢谢!
发表于 2014-5-21 21:02:50 | 显示全部楼层
载入图片前(20行前)先
GUICtrlSetPos ($Pic1, 128, 24, 337, 185)
 楼主| 发表于 2014-5-21 22:03:26 | 显示全部楼层
已解决,谢谢!
发表于 2017-6-30 13:35:19 | 显示全部楼层
自已顶一顶,希望有人帮我解答,谢谢!
发表于 2017-6-30 13:47:19 | 显示全部楼层
本帖最后由 kk_lee69 于 2017-6-30 13:48 编辑

回复 1# cfs43210
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-3-29 14:41 , Processed in 0.077795 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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