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

[GUI管理] 关于GUI界面在FUNC和不在FUNC里面有什么区别吗?[已解决]

  [复制链接]
发表于 2016-11-23 10:24:08 | 显示全部楼层 |阅读模式
本帖最后由 heroxianf 于 2016-11-23 11:06 编辑

请教一个基本问题,界面在func里面  还是不使用func  有什么区别吗?


#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=

test()

Func test()
$Form1 = GUICreate("Form1", 372, 196, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 24, 40, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 64, 104, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
EndFunc

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

        EndSwitch
WEnd


-----------------------------------------------------------

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 372, 196, 192, 124)
$Input1 = GUICtrlCreateInput("Input1", 24, 40, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 64, 104, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

        EndSwitch
WEnd
发表于 2016-11-23 10:27:58 | 显示全部楼层
新手路过 帮顶一下
发表于 2016-11-23 10:45:24 | 显示全部楼层
首先要理解为什么要写成自定义函数,写成函数的目的是为了方便反复调用该函数的功能,避免重复写代码。
如果该界面仅创建一次,那么就没有必要写成函数。
个人拙见,有说得不对的地方还请见谅!
 楼主| 发表于 2016-11-23 10:48:59 | 显示全部楼层
回复 3# 水木子

谢谢水版    明白了。  我还以为写成自定义函数的形式可以减少卡顿现象。
发表于 2016-11-23 10:52:50 | 显示全部楼层
回复 4# heroxianf

写成自定义函数就是为了方便重复调用。
发表于 2017-1-11 07:05:57 | 显示全部楼层
又学会了一个用法
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-18 14:38 , Processed in 0.074314 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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