帮忙把我的代码优化一下! 谢谢!
帮忙把我的代码优化一下! 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 $Eeeor_Code用数组放,文件读行用for循环 {:face (356):} 回复 2# annybaby
我也考虑过Error_Code用数组,但是文本的显示的位置怎么弄啊
在问个问题,怎么设置文字显示的颜色啊?
Thanks ! 回复 4# jwwlchen
1.使用什么变量和后者的显示构成转折关系吗??什么叫"显示位置怎么弄"?
2.GUICtrlSetColor,学习方法:一.搜索帮助,用函数询捕,以关键字"颜色"搜一下,出来的第二个函数就是;二.使用界面设计器KODA,在里面设置一下颜色,然后查看生成的代码~~
页:
[1]