找回密码
 加入
搜索
查看: 5850|回复: 11

[AU3基础] 请问,用什么函数判断图片框是否存在图片,谢谢!(已解决)

  [复制链接]
发表于 2014-5-21 22:32:19 | 显示全部楼层 |阅读模式
本帖最后由 cfs43210 于 2014-5-25 23:12 编辑
#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("插入", 10, 272, 145, 73)
$Pic1 = GUICtrlCreatePic("", 128, 24, 337, 185)
$Button2 = GUICtrlCreateButton("清空", 200, 272, 153, 81)
$Button3 = GUICtrlCreateButton("读取图片框", 376, 272, 153, 81)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
Local $aa
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        $var = FileOpenDialog("浏览照片", @MyDocumentsDir & "", "图像文件 (*.jpg;*.bmp)", 1 + 4)
                        GUICtrlSetResizing($Pic1, $GUI_DOCKSIZE)
                        GUICtrlSetPos($Pic1, 128, 24, 337, 185)
                        $aa=GUICtrlSetImage($Pic1, $var)

                Case $Button2
                        $aa=GUICtrlSetImage($Pic1, "") ;清空图片
                        
                        
                Case $Button3
                        MsgBox(0, 0, $aa);图片框有无图片在时,怎样怪返回值

        EndSwitch

WEnd
请问,用什么函数判断图片框是否存在图片,谢谢!
 楼主| 发表于 2014-5-22 09:42:40 | 显示全部楼层
自己顶下,希望有人帮忙。谢谢!
发表于 2014-5-22 09:52:37 | 显示全部楼层
源码起码也要发出来啊
 楼主| 发表于 2014-5-22 12:18:27 | 显示全部楼层
源码已发,谢谢!
发表于 2014-5-22 13:08:31 | 显示全部楼层
回复 1# cfs43210

請問一下 如果依照 上面程式  有圖片檔案  理論上 照片應該存在

你所謂的  不存在 是怕  有檔案 無 檔案內容嗎  或者 內容不對嗎??


如果 是 有個判斷方法  就是 讀取照片的檔案 內容   如果是圖片檔案  會是固定格式的開頭的格式
 楼主| 发表于 2014-5-22 19:02:11 | 显示全部楼层
回复 5# kk_lee69
我的意思是没照片提示不能写入数据,谢谢你!
 楼主| 发表于 2014-5-22 22:04:16 | 显示全部楼层
顶一顶,难道没有办法判断图片是否存在图片控件内吗???
发表于 2014-5-22 23:16:22 | 显示全部楼层
源码起码也要发出来啊
 楼主| 发表于 2014-5-23 00:05:13 | 显示全部楼层
回复 9# qsy666888
不是发了源码?
发表于 2014-5-23 09:02:40 | 显示全部楼层
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Form1", 623, 445, 192, 124)
        $Pic1 = GUICtrlCreatePic("", 128, 24, 337, 185)

        $Button1 = GUICtrlCreateButton("插入", 10, 272, 145, 73)
        $Button2 = GUICtrlCreateButton("清空", 200, 272, 153, 81)
        $Button3 = GUICtrlCreateButton("读取图片框", 376, 272, 153, 81)
GUISetState(@SW_SHOW)

Local $aa = "无图片"

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

                Case $Button2
                        GUICtrlSetImage($Pic1, "")
                        $aa = "无图片" ;清空图片

                Case $Button3
                        MsgBox(0, 0, $aa);图片框有无图片在时,怎样怪返回值

        EndSwitch

WEnd
发表于 2014-5-23 09:08:53 | 显示全部楼层
回复 6# cfs43210


    可以 定義一下 沒照片的意思嗎??  是指 沒圖片檔案??
 楼主| 发表于 2014-5-25 23:11:54 | 显示全部楼层
已解决,谢谢!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-28 05:16 , Processed in 0.091647 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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