找回密码
 加入
搜索
查看: 2703|回复: 4

[AU3基础] 帮忙把我的代码优化一下! 谢谢!

[复制链接]
发表于 2013-1-17 06:29:20 | 显示全部楼层 |阅读模式
帮忙把我的代码优化一下! Show_ErrorCode()这个函数有什么办法可以写简单点吗!
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <file.au3>

 #NoTrayIcon
Local $msg
GuiCreate("测试良率报警系统", 800, 600)

$label0=GUICtrlCreateLabel("测试良率报警系统",300,50,400,60)
$label1=GUICtrlCreateLabel("您已连续测试了 5 PCS 不良 !",100,150,400,60)
$label2=GUICtrlCreateLabel("请 Call On-Line 工程师分析 !",100,190,400,100) 
$label3=GUICtrlCreateLabel("您是否要继续测试?",250,480,220,100)
$Button_1= GUICtrlCreateButton ("继续进行测试", 500, 450, 150, 70)

GUICtrlSetFont($label0, 16, 800, "", "Comic Sans MS")
GUICtrlSetFont($label1, 16, 800, "", "Comic Sans MS")
GUICtrlSetFont($label2, 16, 800, "", "Comic Sans MS")
GUICtrlSetFont($label3, 16, 800, "", "Comic Sans MS")
GUICtrlSetFont($Button_1, 12, 800, "", "Comic Sans MS")

GuiSetState()

WinSetOnTop("测试良率报警系统", "", 1)

Show_ErrorCode()

While 1
                $msg = GUIGetMsg()
                Select
                        Case $msg = $GUI_EVENT_MINIMIZE
                                WinActivate ("测试良率报警系统")
                        Case $msg = $Button_1
                                FileDelete ("C:\Alarm\*.*")
                                ExitLoop
                EndSelect
WEnd
GUIDelete()

Func Show_ErrorCode()
        $Eeeor_Code0=GUICtrlCreateLabel("Error_Code :",100,250,180,80)
        GUICtrlSetFont($Eeeor_Code0, 16, 800, "", "Comic Sans MS")
        
        $file = FileOpen("C:\Alarm\ErrorCode_Info.txt", 0)
        
        $line1 = FileReadLine($file,1)
        $Eeeor_Code1=GUICtrlCreateLabel($line1,150,300,100,100)
        GUICtrlSetFont($Eeeor_Code1, 16, 800, "", "Comic Sans MS")
        
        $line2 = FileReadLine($file,2)
        $Eeeor_Code2=GUICtrlCreateLabel($line2,230,300,100,100)
        GUICtrlSetFont($Eeeor_Code2, 16, 800, "", "Comic Sans MS")
        
        $line3 = FileReadLine($file,3)
        $Eeeor_Code3=GUICtrlCreateLabel($line3,310,300,100,100)
        GUICtrlSetFont($Eeeor_Code3, 16, 800, "", "Comic Sans MS")
        
        $line4 = FileReadLine($file,4)
        $Eeeor_Code4=GUICtrlCreateLabel($line4,150,350,100,100)
        GUICtrlSetFont($Eeeor_Code4, 16, 800, "", "Comic Sans MS")

        $line5 = FileReadLine($file,5)
        $Eeeor_Code5=GUICtrlCreateLabel($line5,230,350,100,100)
        GUICtrlSetFont($Eeeor_Code5, 16, 800, "", "Comic Sans MS")
        
        FileClose($file)
EndFunc
发表于 2013-1-17 12:55:08 | 显示全部楼层
$Eeeor_Code用数组放,文件读行用for循环
发表于 2013-1-17 13:41:07 | 显示全部楼层

评分

参与人数 2金钱 -30 贡献 -8 收起 理由
annybaby -10 -4 是的,金牌以上可以扣~
happytc -20 -4 听说可以扣分,我试试

查看全部评分

 楼主| 发表于 2013-1-17 20:29:34 | 显示全部楼层
回复 2# annybaby

我也考虑过Error_Code用数组,但是文本的显示的位置怎么弄啊

在问个问题,怎么设置文字显示的颜色啊?

Thanks !
发表于 2013-1-17 20:53:10 | 显示全部楼层
回复 4# jwwlchen


    1.使用什么变量和后者的显示构成转折关系吗??什么叫"显示位置怎么弄"?
2.GUICtrlSetColor,学习方法:一.搜索帮助,用函数询捕,以关键字"颜色"搜一下,出来的第二个函数就是;二.使用界面设计器KODA,在里面设置一下颜色,然后查看生成的代码~~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-3 03:51 , Processed in 0.088701 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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