请高手帮我看看,我写的小软件为什么运行很慢?(已解决)
本帖最后由 fsyuecw 于 2012-7-24 20:16 编辑因工作关系,写了一个光路计算工具,还算好用,但运行中很慢,输入头同几参数还行,后边越来越慢。另外,需要在窗体上画箭头,没想出来办法,画了两个图片调用,但一动窗体,这个箭头就把输入框给覆盖了。请哪们大虾指点一下,不胜感谢。
#include <EditConstants.au3>
#include <array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Dim $OpticalStationName="光节点名"
Dim $Juli,$Less,$Lessmain,$Lesssub,$SubJuli,$SubLess
Dim $m,$n,$Length,$SubLength
Dim $h=29,$v=175
Dim $d5=15.2,$d95=0.45,$d10=11.3,$d90=0.6,$d20=7.9,$d80=1.2,$d25=8.5,$d75=1.8,$d50=3.6
Dim $D_Main,$D_Sub
GUICreate("简易EPON树形链路设计器——清原县广电局(2012-3)",1250,520)
;创建起点
GUICtrlCreateLabel("起点名称",15,71,60,20)
GUICtrlCreateInput("",5,87,60,20)
;GUICtrlCreateLabel("PON",15,89,30,20)
;GUICtrlCreateInput($OpticalStationName,10,65)
;循环创建其它光节点
GUISetState()
For $n=1 to 10
;画主路分光数据栏
GUICtrlCreateLabel(" 分光点"&$n&@crlf&"距离"&@CRLF&"衰减"&@CRLF&"主衰"&@crlf&"支衰",$n*110-2,20,75,64);分光点标签
GUICtrlSetBkColor(-1,0x00aa00);将上面标签加绿背景色
$Juli[$n-1]=GUICtrlCreateLabel("",$n*110+$h,32,43,15);显示距离的标签
;GUICtrlSetState(-1, $gui_DISABLE)
GUICtrlSetBkColor(-1,0x88aa00);将上面标签加黄背景色
$Less[$n-1]=GUICtrlCreateLabel("",$n*110+$h,44,43,15);显示上级光缆衰减值
;GUICtrlSetState(-1, $gui_DISABLE)
GUICtrlSetBkColor(-1,0x00aaaa);将上面标签加青北景色
$Lessmain[$n-1]=GUICtrlCreateLabel("",$n*110+$h,56,43,15);显示主路衰减值
;GUICtrlSetState(-1, $gui_DISABLE)
GUICtrlSetBkColor(-1,0xaaaa00);将上面标签加黄背景色
$Lesssub[$n-1]=GUICtrlCreateLabel("",$n*110+$h,68,43,15);显示支路衰减值
;GUICtrlSetState(-1, $gui_DISABLE)
GUICtrlSetBkColor(-1,0x00ffaa);将上面标签加蓝背景色
;GUICtrlCreateInput("分光点",$n*110-2,16,75,17);分光点名称输入框
;画分路分光数据栏
GUICtrlCreateLabel(" 支光节点"&$n&@crlf&"距离"&@CRLF&"衰减",$n*110-10,$v+20,75,40);分光点标签
GUICtrlSetBkColor(-1,0x00aa00);将上面标签加绿背景色
$SubJuli[$n-1]=GUICtrlCreateLabel("",$n*110+22,$v+32,43,15);显示距离的标签
;GUICtrlSetState(-1, $gui_DISABLE)
GUICtrlSetBkColor(-1,0x88aa00);将上面标签加黄背景色
$SubLess[$n-1]=GUICtrlCreateLabel("",$n*110+22,$v+44,43,15);显示上级光路衰减值
;GUICtrlSetState(-1, $gui_DISABLE)
GUICtrlSetBkColor(-1,0x00aaaa);将上面标签加青北景色
;说明标签
GUICtrlCreateLabel("说明:"&@CRLF&"1、分光点数据定义:距离=分光器到前端的距离(千米)。衰减=分光器入口到前端的光路损耗(dB)。主衰=分光器主路衰减量(dB)。支衰=分光器支路衰减量(dB)。"&@CRLF&"2、支路光节点:距离=ONU到前端的距离(千米)。衰减=ONU距前端的光路衰减量(dB)"&@CRLF&"3、光分路器只需输入支路分光比即可,本软件只支持5:95、10:90、20:80、25:75、50:50五种分光器。"&@CRLF&"4、光路衰减按1310nm每千米0.35dB计算,每点增加0.1的法兰衰减量"&@CRLF&"5、分光比参照华为设计原则确定,不同厂家不同工艺分光比会有差异。"&@CRLF&" 本软件采用的是:5:95(15.2:0.45)、10:90(11.3:0.6)、20:80(7.9:1.2)、25:75(8.5:1.8)、50:50(3.6:3.6),括号内为对应的衰减量,单位是dB."&@CRLF&"6、本软件只支持单支岔结构。"&@CRLF&"7、本软件计算结果仅做参考。"&@CRLF&"8、设计参考:20千米模块建议光链路衰减应大于6dB小于27dB。",120,300,1200,120)
;创建输入框
$Length[$n-1]=GUICtrlCreateInput("",$n*110-38,89,37,15);两点间距离输入框(主路)
$SubLength[$n-1]=GUICtrlCreateInput("",$n*110+6,130,37,15);两点间距离输入框(支路)
$D_Sub[$n-1]=GUICtrlCreateInput("支",$n*110+14,89,20,15);支路分光比
$D_Main[$n-1]=GUICtrlCreateInput("主",$n*110+33,89,20,15);主路分光比
$picjiantouh=GUICtrlCreatePic("jiantouh.jpg",$n*110-56,91,75,10);画水平箭头
$picjiantouv=GUICtrlCreatePic("jiantouv.jpg",$n*110+18,91,10,105);画垂直箭头
;$con=GUICtrlCreateLabel("",500,300,50,15)
;If $Length[$n-1]<>0 Then
Next
GUISetState()
GUIRegisterMsg($WM_COMMAND,"MY_WM_COMMAND")
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func MY_WM_COMMAND($hWnd, $msg, $wParam, $ilParam);主函数
Dim $i=0,$j=0
Local $subnumber
Do
if GUICtrlRead($Length) <> "" then
$subnumber = GUICtrlRead($D_Sub)
If $subnumber <> "支" Then
GUICtrlSetData($D_Main,100-$subnumber)
GUICtrlSetData($Lesssub, MY_SubLess($subnumber));支路衰减计算
GUICtrlSetData($Lessmain, MY_MainLess(100-$subnumber));主路衰减计算
EndIf
GUICtrlSetData($Less, GUICtrlRead($Length)*0.35+0.1)
GUICtrlSetData($Juli,GUICtrlRead($Length))
;计算支路数据
if GUICtrlRead($SubLength) <> "" then
GUICtrlSetData($SubLess, GUICtrlRead($SubLength)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lesssub))
GUICtrlSetData($SubJuli,GUICtrlRead($Juli)+GUICtrlRead($SubLength))
EndIf
EndIf
if GUICtrlRead($Length) <> "" then
$subnumber = GUICtrlRead($D_Sub)
If $subnumber <> "支" Then
GUICtrlSetData($D_Main,100-$subnumber)
GUICtrlSetData($Lesssub, MY_SubLess($subnumber));支路衰减计算
GUICtrlSetData($Lessmain, MY_MainLess(100-$subnumber));主路衰减计算
EndIf
GUICtrlSetData($Less, GUICtrlRead($Length)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lessmain))
GUICtrlSetData($Juli,GUICtrlRead($Juli)+GUICtrlRead($Length))
;计算支路数据
if GUICtrlRead($SubLength) <> "" then
GUICtrlSetData($SubLess, GUICtrlRead($SubLength)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lesssub))
GUICtrlSetData($SubJuli,GUICtrlRead($Juli)+GUICtrlRead($SubLength))
EndIf
EndIf
if GUICtrlRead($Length) <> "" then
$subnumber = GUICtrlRead($D_Sub)
If $subnumber <> "支" Then
GUICtrlSetData($D_Main,100-$subnumber)
GUICtrlSetData($Lesssub, MY_SubLess($subnumber));支路衰减计算
GUICtrlSetData($Lessmain, MY_MainLess(100-$subnumber));主路衰减计算
EndIf
GUICtrlSetData($Less, GUICtrlRead($Length)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lessmain))
GUICtrlSetData($Juli,GUICtrlRead($Juli)+GUICtrlRead($Length))
;计算支路数据
if GUICtrlRead($SubLength) <> "" then
GUICtrlSetData($SubLess, GUICtrlRead($SubLength)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lesssub))
GUICtrlSetData($SubJuli,GUICtrlRead($Juli)+GUICtrlRead($SubLength))
EndIf
EndIf
if GUICtrlRead($Length) <> "" then
$subnumber = GUICtrlRead($D_Sub)
If $subnumber <> "支" Then
GUICtrlSetData($D_Main,100-$subnumber)
GUICtrlSetData($Lesssub, MY_SubLess($subnumber));支路衰减计算
GUICtrlSetData($Lessmain, MY_MainLess(100-$subnumber));主路衰减计算
EndIf
GUICtrlSetData($Less, GUICtrlRead($Length)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lessmain))
GUICtrlSetData($Juli,GUICtrlRead($Juli)+GUICtrlRead($Length))
;计算支路数据
if GUICtrlRead($SubLength) <> "" then
GUICtrlSetData($SubLess, GUICtrlRead($SubLength)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lesssub))
GUICtrlSetData($SubJuli,GUICtrlRead($Juli)+GUICtrlRead($SubLength))
EndIf
EndIf
if GUICtrlRead($Length) <> "" then
$subnumber = GUICtrlRead($D_Sub)
If $subnumber <> "支" Then
GUICtrlSetData($D_Main,100-$subnumber)
GUICtrlSetData($Lesssub, MY_SubLess($subnumber));支路衰减计算
GUICtrlSetData($Lessmain, MY_MainLess(100-$subnumber));主路衰减计算
EndIf
GUICtrlSetData($Less, GUICtrlRead($Length)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lessmain))
GUICtrlSetData($Juli,GUICtrlRead($Juli)+GUICtrlRead($Length))
;计算支路数据
if GUICtrlRead($SubLength) <> "" then
GUICtrlSetData($SubLess, GUICtrlRead($SubLength)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lesssub))
GUICtrlSetData($SubJuli,GUICtrlRead($Juli)+GUICtrlRead($SubLength))
EndIf
EndIf
if GUICtrlRead($Length) <> "" then
$subnumber = GUICtrlRead($D_Sub)
If $subnumber <> "支" Then
GUICtrlSetData($D_Main,100-$subnumber)
GUICtrlSetData($Lesssub, MY_SubLess($subnumber));支路衰减计算
GUICtrlSetData($Lessmain, MY_MainLess(100-$subnumber));主路衰减计算
EndIf
GUICtrlSetData($Less, GUICtrlRead($Length)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lessmain))
GUICtrlSetData($Juli,GUICtrlRead($Juli)+GUICtrlRead($Length))
;计算支路数据
if GUICtrlRead($SubLength) <> "" then
GUICtrlSetData($SubLess, GUICtrlRead($SubLength)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lesssub))
GUICtrlSetData($SubJuli,GUICtrlRead($Juli)+GUICtrlRead($SubLength))
EndIf
EndIf
if GUICtrlRead($Length) <> "" then
$subnumber = GUICtrlRead($D_Sub)
If $subnumber <> "支" Then
GUICtrlSetData($D_Main,100-$subnumber)
GUICtrlSetData($Lesssub, MY_SubLess($subnumber));支路衰减计算
GUICtrlSetData($Lessmain, MY_MainLess(100-$subnumber));主路衰减计算
EndIf
GUICtrlSetData($Less, GUICtrlRead($Length)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lessmain))
GUICtrlSetData($Juli,GUICtrlRead($Juli)+GUICtrlRead($Length))
;计算支路数据
if GUICtrlRead($SubLength) <> "" then
GUICtrlSetData($SubLess, GUICtrlRead($SubLength)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lesssub))
GUICtrlSetData($SubJuli,GUICtrlRead($Juli)+GUICtrlRead($SubLength))
EndIf
EndIf
if GUICtrlRead($Length) <> "" then
$subnumber = GUICtrlRead($D_Sub)
If $subnumber <> "支" Then
GUICtrlSetData($D_Main,100-$subnumber)
GUICtrlSetData($Lesssub, MY_SubLess($subnumber));支路衰减计算
GUICtrlSetData($Lessmain, MY_MainLess(100-$subnumber));主路衰减计算
EndIf
GUICtrlSetData($Less, GUICtrlRead($Length)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lessmain))
GUICtrlSetData($Juli,GUICtrlRead($Juli)+GUICtrlRead($Length))
;计算支路数据
if GUICtrlRead($SubLength) <> "" then
GUICtrlSetData($SubLess, GUICtrlRead($SubLength)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lesssub))
GUICtrlSetData($SubJuli,GUICtrlRead($Juli)+GUICtrlRead($SubLength))
EndIf
EndIf
if GUICtrlRead($Length) <> "" then
$subnumber = GUICtrlRead($D_Sub)
If $subnumber <> "支" Then
GUICtrlSetData($D_Main,100-$subnumber)
GUICtrlSetData($Lesssub, MY_SubLess($subnumber));支路衰减计算
GUICtrlSetData($Lessmain, MY_MainLess(100-$subnumber));主路衰减计算
EndIf
GUICtrlSetData($Less, GUICtrlRead($Length)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lessmain))
GUICtrlSetData($Juli,GUICtrlRead($Juli)+GUICtrlRead($Length))
;计算支路数据
if GUICtrlRead($SubLength) <> "" then
GUICtrlSetData($SubLess, GUICtrlRead($SubLength)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lesssub))
GUICtrlSetData($SubJuli,GUICtrlRead($Juli)+GUICtrlRead($SubLength))
EndIf
EndIf
if GUICtrlRead($Length) <> "" then
$subnumber = GUICtrlRead($D_Sub)
If $subnumber <> "支" Then
GUICtrlSetData($D_Main,100-$subnumber)
GUICtrlSetData($Lesssub, MY_SubLess($subnumber));支路衰减计算
GUICtrlSetData($Lessmain, MY_MainLess(100-$subnumber));主路衰减计算
EndIf
GUICtrlSetData($Less, GUICtrlRead($Length)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lessmain))
GUICtrlSetData($Juli,GUICtrlRead($Juli)+GUICtrlRead($Length))
;计算支路数据
if GUICtrlRead($SubLength) <> "" then
GUICtrlSetData($SubLess, GUICtrlRead($SubLength)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lesssub))
GUICtrlSetData($SubJuli,GUICtrlRead($Juli)+GUICtrlRead($SubLength))
EndIf
EndIf
$i=$i+1
Until $i =100
;Return $GUI_RUNDEFMSG
EndFunc ;==>MY_WM_COMMAND
Func MY_SubLess ($sub)
Select
Case $sub=5
$sub=$d5
Return $sub
Case $sub=10
$sub=$d10
Return $sub
Case $sub=20
$sub=$d20
Return $sub
Case $sub=25
$sub=$d25
Return $sub
Case $sub=50
$sub=$d50
Return $sub
;MsgBox(2,"输入错误","本软件只支持5:95 10:90 20:80 25:75 %0:50分路器")
EndSelect
EndFunc
Func MY_MainLess($sub)
Select
Case $sub=95
$sub=$d95
Return $sub
Case $sub=90
$sub=$d90
Return $sub
Case $sub=80
$sub=$d80
Return $sub
Case $sub=75
$sub=$d75
Return $sub
Case $sub=50
$sub=$d50
Return $sub
;MsgBox(2,"输入错误","本软件只支持5:95 10:90 20:80 25:75 %0:50分路器")
EndSelect
EndFunc
;GUIRegisterMsg($WM_COMMAND,"MY_WM_COMMAND1") 这是那两个箭头图片 楼主辛苦了,还在搞这个玩意呢。有一年了么? 厉害............. 完全看不懂啊,这东西 可以简化一些不?
A大曾经给小弟做过这样一个,特别好用的。楼主看看能否用到
http://www.autoitx.com/thread-30241-3-1.html
31楼,也是用 FOR 的 看出一个:
说明 应该可以写在 FOR 外面吧 专业技术不懂,不过 MY_WM_COMMAND 里面的 Do 循环100次无用,去除即可。 回复 1# fsyuecw
对GUI要求不高的话,你应该用EVENT模式 if GUICtrlRead($Length) <> "" then
$subnumber = GUICtrlRead($D_Sub)
If $subnumber <> "支" Then
GUICtrlSetData($D_Main,100-$subnumber)
GUICtrlSetData($Lesssub, MY_SubLess($subnumber));支路衰减计算
GUICtrlSetData($Lessmain, MY_MainLess(100-$subnumber));主路衰减计算
EndIf
GUICtrlSetData($Less, GUICtrlRead($Length)*0.35+0.1)
GUICtrlSetData($Juli,GUICtrlRead($Length))
;计算支路数据
if GUICtrlRead($SubLength) <> "" then
GUICtrlSetData($SubLess, GUICtrlRead($SubLength)*0.35+0.1+GUICtrlRead($Less)+GUICtrlRead($Lesssub))
GUICtrlSetData($SubJuli,GUICtrlRead($Juli)+GUICtrlRead($SubLength))
EndIf
EndIf还有这个代码,我看了一下,同一个数组,你根本不用一个个写啊。用这个代替$Num,$Num++。这样子不就可以了。 本帖最后由 甜茶少年 于 2012-7-24 18:02 编辑
#include <EditConstants.au3>
#include <array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Local $Num
Dim $OpticalStationName="光节点名"
Dim $Juli,$Less,$Lessmain,$Lesssub,$SubJuli,$SubLess
Dim $m,$n,$Length,$SubLength
Dim $h=29,$v=175
Dim $d5=15.2,$d95=0.45,$d10=11.3,$d90=0.6,$d20=7.9,$d80=1.2,$d25=8.5,$d75=1.8,$d50=3.6
Dim $D_Main,$D_Sub
GUICreate("简易EPON树形链路设计器——清原县广电局(2012-3)",1250,520)
;创建起点
GUICtrlCreateLabel("起点名称",15,71,60,20)
GUICtrlCreateInput("",5,87,60,20)
GUISetState()
For $n=1 to 10
;画主路分光数据栏
GUICtrlCreateLabel(" 分光点"&$n&@crlf&"距离"&@CRLF&"衰减"&@CRLF&"主衰"&@crlf&"支衰",$n*110-2,20,75,64);分光点标签
GUICtrlSetBkColor(-1,0x00aa00);将上面标签加绿背景色
$Juli[$n-1]=GUICtrlCreateLabel("",$n*110+$h,32,43,15);显示距离的标签
;GUICtrlSetState(-1, $gui_DISABLE)
GUICtrlSetBkColor(-1,0x88aa00);将上面标签加黄背景色
$Less[$n-1]=GUICtrlCreateLabel("",$n*110+$h,44,43,15);显示上级光缆衰减值
;GUICtrlSetState(-1, $gui_DISABLE)
GUICtrlSetBkColor(-1,0x00aaaa);将上面标签加青北景色
$Lessmain[$n-1]=GUICtrlCreateLabel("",$n*110+$h,56,43,15);显示主路衰减值
;GUICtrlSetState(-1, $gui_DISABLE)
GUICtrlSetBkColor(-1,0xaaaa00);将上面标签加黄背景色
$Lesssub[$n-1]=GUICtrlCreateLabel("",$n*110+$h,68,43,15);显示支路衰减值
;GUICtrlSetState(-1, $gui_DISABLE)
GUICtrlSetBkColor(-1,0x00ffaa);将上面标签加蓝背景色
;GUICtrlCreateInput("分光点",$n*110-2,16,75,17);分光点名称输入框
;画分路分光数据栏
GUICtrlCreateLabel(" 支光节点"&$n&@crlf&"距离"&@CRLF&"衰减",$n*110-10,$v+20,75,40);分光点标签
GUICtrlSetBkColor(-1,0x00aa00);将上面标签加绿背景色
$SubJuli[$n-1]=GUICtrlCreateLabel("",$n*110+22,$v+32,43,15);显示距离的标签
;GUICtrlSetState(-1, $gui_DISABLE)
GUICtrlSetBkColor(-1,0x88aa00);将上面标签加黄背景色
$SubLess[$n-1]=GUICtrlCreateLabel("",$n*110+22,$v+44,43,15);显示上级光路衰减值
;GUICtrlSetState(-1, $gui_DISABLE)
GUICtrlSetBkColor(-1,0x00aaaa);将上面标签加青北景色
;创建输入框
$Length[$n-1]=GUICtrlCreateInput("",$n*110-38,89,37,15);两点间距离输入框(主路)
$SubLength[$n-1]=GUICtrlCreateInput("",$n*110+6,130,37,15);两点间距离输入框(支路)
$D_Sub[$n-1]=GUICtrlCreateInput("支",$n*110+14,89,20,15);支路分光比
$D_Main[$n-1]=GUICtrlCreateInput("主",$n*110+33,89,20,15);主路分光比
$picjiantouh=GUICtrlCreatePic("jiantouh.jpg",$n*110-56,91,75,10);画水平箭头
$picjiantouv=GUICtrlCreatePic("jiantouv.jpg",$n*110+18,91,10,105);画垂直箭头
Sleep(100)
Next
;说明标签
GUICtrlCreateLabel("说明:"&@CRLF&"1、分光点数据定义:距离=分光器到前端的距离(千米)。衰减=分光器入口到前端的光路损耗(dB)。主衰=分光器主路衰减量(dB)。支衰=分光器支路衰减量(dB)。"&@CRLF&"2、支路光节点:距离=ONU到前端的距离(千米)。衰减=ONU距前端的光路衰减量(dB)"&@CRLF&"3、光分路器只需输入支路分光比即可,本软件只支持5:95、10:90、20:80、25:75、50:50五种分光器。"&@CRLF&"4、光路衰减按1310nm每千米0.35dB计算,每点增加0.1的法兰衰减量"&@CRLF&"5、分光比参照华为设计原则确定,不同厂家不同工艺分光比会有差异。"&@CRLF&" 本软件采用的是:5:95(15.2:0.45)、10:90(11.3:0.6)、20:80(7.9:1.2)、25:75(8.5:1.8)、50:50(3.6:3.6),括号内为对应的衰减量,单位是dB."&@CRLF&"6、本软件只支持单支岔结构。"&@CRLF&"7、本软件计算结果仅做参考。"&@CRLF&"8、设计参考:20千米模块建议光链路衰减应大于6dB小于27dB。",120,300,1200,120)
GUISetState()
GUIRegisterMsg($WM_COMMAND,"MY_WM_COMMAND")
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func MY_WM_COMMAND($hWnd, $msg, $wParam, $ilParam);主函数
Dim $i=0,$j=0
Local $subnumber
$Num=0
Do
if GUICtrlRead($Length[$Num]) <> "" then
$subnumber = GUICtrlRead($D_Sub[$Num])
If $subnumber <> "支" Then
GUICtrlSetData($D_Main[$Num],100-$subnumber)
GUICtrlSetData($Lesssub[$Num], MY_SubLess($subnumber));支路衰减计算
GUICtrlSetData($Lessmain[$Num], MY_MainLess(100-$subnumber));主路衰减计算
EndIf
GUICtrlSetData($Less[$Num], GUICtrlRead($Length[$Num])*0.35+0.1)
GUICtrlSetData($Juli[$Num],GUICtrlRead($Length[$Num]))
;计算支路数据
if GUICtrlRead($SubLength[$Num]) <> "" then
GUICtrlSetData($SubLess[$Num], GUICtrlRead($SubLength[$Num])*0.35+0.1+GUICtrlRead($Less[$Num])+GUICtrlRead($Lesssub[$Num]))
GUICtrlSetData($SubJuli[$Num],GUICtrlRead($Juli[$Num])+GUICtrlRead($SubLength[$Num]))
EndIf
EndIf
$Num=$Num+1
Until $Num=10
;Return $GUI_RUNDEFMSG
EndFunc ;==>MY_WM_COMMAND
Func MY_SubLess ($sub)
Select
Case $sub=5
$sub=$d5
Return $sub
Case $sub=10
$sub=$d10
Return $sub
Case $sub=20
$sub=$d20
Return $sub
Case $sub=25
$sub=$d25
Return $sub
Case $sub=50
$sub=$d50
Return $sub
;MsgBox(2,"输入错误","本软件只支持5:95 10:90 20:80 25:75 %0:50分路器")
EndSelect
EndFunc
Func MY_MainLess($sub)
Select
Case $sub=95
$sub=$d95
Return $sub
Case $sub=90
$sub=$d90
Return $sub
Case $sub=80
$sub=$d80
Return $sub
Case $sub=75
$sub=$d75
Return $sub
Case $sub=50
$sub=$d50
Return $sub
;MsgBox(2,"输入错误","本软件只支持5:95 10:90 20:80 25:75 %0:50分路器")
EndSelect
EndFunc
我大致改了一下,说实话,这是你的专业,我看不懂这丫的是要干嘛,大致对代码进行了优化,输了几个数据也有结果。但是,这个程序我不会用,你自己试试看,有没有错误。 还有,你这个代码是在乱的很。 回复 3# haijie1223
不辛苦,为了生活嘛,呵呵。谢谢您当年的指导! 回复 5# 魔导
是两种东西哟,呵呵。不一样的 回复 10# 甜茶少年
谢谢,我试了,好用,厉害呀,呵呵,不懂的东西都能帮我弄好。我原来也想过用一个变量通过循环加1的方法来实现,后来我自己也不记得为什么没有采用,我只是初学者,本来不是想学编程,只是需要,才看帮助文件学了一点点皮毛。今后再下点功夫,还望多多指点。再一次表示感谢。我会认真再读一下你改过的代码——的确比原来快了。{:face (316):} 另外,有办法在窗体上画箭头吗?不用图形控件。不想编译完了,还要考过去两个图片文件,呵呵,太不专业了。请再指点一下。谢谢
页:
[1]
2