如何帶數值到自由拉伸的表格
請問一下, 如果我有一個代數$host, 有4 組ip$host=192.168.1.1
$host=192.168.1.4
$host=192.168.1.6
$host=192.168.1.9
這4組要分別填到你的自由拉伸的表格裡, 要怎麼寫呢?
http://www.autoitx.com/forum.php?mod=viewthread&tid=29017&highlight=%B1%ED%B8%F1
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
Opt("GUIOnEventMode", 1)
Local $Edit,$Hount=3,$WCount=3,$Ctr,$j=0
$Form1 = GUICreate("Form1", 700, 444, 150, 120)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
For $b = 1 to $Hount
For $a = 1 to $WCount
$j = $j + 1
$Edit[$a][$b] =GUICtrlCreateEdit($j, 130+($a-1)*170, 66+($b-1)*90, 170, 90, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
Next
Next
$Label1 = GUICtrlCreateLabel("把鼠标移到边线 按下左键 可以调整单元格的大小", 200, 10, 300, 17)
GUISetState(@SW_SHOW)
While 1
Sleep(1)
$GUICur = GUIGetCursorInfo($Form1)
If $GUICur = 1 Then
lashen()
EndIf
WEnd
Func lashen()
$k = 1
$Ctr1 = ControlGetPos("Form1","",$Edit) ;控件信息
$Ctr2 = ControlGetPos("Form1","",$Edit)
$Ctr3 = ControlGetPos("Form1","",$Edit)
$Ctr4 = ControlGetPos("Form1","",$Edit)
$Ctr5 = ControlGetPos("Form1","",$Edit)
$Ctr6 = ControlGetPos("Form1","",$Edit)
$Ctr7 = ControlGetPos("Form1","",$Edit)
$Ctr8 = ControlGetPos("Form1","",$Edit)
$Ctr9 = ControlGetPos("Form1","",$Edit)
$nPos = WinGetPos("Form1") ;主窗信息
;-------------------------------------------------------------------------------右边
$La1x1 = ($GUICur > $Ctr1 + $Ctr1- 8)
$La1x2 = ($GUICur < $Ctr1 + $Ctr1)
$La2x1 = ($GUICur > $Ctr2 + $Ctr2- 8)
$La2x2 = ($GUICur < $Ctr2 + $Ctr2)
$La3x1 = ($GUICur > $Ctr3 + $Ctr3- 8)
$La3x2 = ($GUICur < $Ctr3 + $Ctr3)
;--------------------------------------------------------------------------------左边
$Ra1x1 = ($GUICur < $Ctr1+ 8)
$Ra1x2 = ($GUICur > $Ctr1)
$Ra2x1 = ($GUICur < $Ctr2+ 8)
$Ra2x2 = ($GUICur > $Ctr2)
$Ra3x1 = ($GUICur < $Ctr3+ 8)
$Ra3x2 = ($GUICur > $Ctr3)
;------------------------------------------------------------------------------ 上边
$Ta1y1 = ($GUICur < $Ctr1+ 8)
$Ta1y2 = ($GUICur > $Ctr1)
$Ta4y1 = ($GUICur < $Ctr4+ 8)
$Ta4y2 = ($GUICur > $Ctr4)
$Ta7y1 = ($GUICur < $Ctr7+ 8)
$Ta7y2 = ($GUICur > $Ctr7)
;------------------------------------------------------------------------------下边
$Ea1y1 = ($GUICur > $Ctr1 + $Ctr1- 8)
$Ea1y2 = ($GUICur < $Ctr1 + $Ctr1)
$Ea4y1 = ($GUICur > $Ctr4 + $Ctr4- 8)
$Ea4y2 = ($GUICur < $Ctr4 + $Ctr4)
$Ea7y1 = ($GUICur > $Ctr7 + $Ctr7- 8)
$Ea7y2 = ($GUICur < $Ctr7 + $Ctr7)
;------------------------------------------------------------------------------
If $La1x1 And $La1x2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit,$Ctr1,$Ctr1,$GUICur+4-$Ctr1,$Ctr1)
ControlMove ("Form1","", $Edit,$Ctr4,$Ctr4,$GUICur+4-$Ctr4,$Ctr4)
ControlMove ("Form1","", $Edit,$Ctr7,$Ctr7,$GUICur+4-$Ctr7,$Ctr7)
ControlMove ("Form1","", $Edit,$GUICur+8-4,$Ctr2,$Ctr2-($GUICur+8-4-$Ctr2),$Ctr2)
ControlMove ("Form1","", $Edit,$GUICur+8-4,$Ctr5,$Ctr5-($GUICur+8-4-$Ctr5),$Ctr5)
ControlMove ("Form1","", $Edit,$GUICur+8-4,$Ctr8,$Ctr8-($GUICur+8-4-$Ctr8),$Ctr8)
EndIf
EndIf
If $Ra1x1 And $Ra1x2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit,$GUICur-4,$Ctr1,$Ctr1-($GUICur-4-$Ctr1),$Ctr1)
ControlMove ("Form1","", $Edit,$GUICur-4,$Ctr4,$Ctr4-($GUICur-4-$Ctr4),$Ctr4)
ControlMove ("Form1","", $Edit,$GUICur-4,$Ctr7,$Ctr7-($GUICur-4-$Ctr7),$Ctr7)
EndIf
EndIf
If $Ta1y1 And $Ta1y2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit,$Ctr1,$GUICur-4,$Ctr1,$Ctr1-($GUICur-4-$Ctr1))
ControlMove ("Form1","", $Edit,$Ctr2,$GUICur-4,$Ctr2,$Ctr2-($GUICur-4-$Ctr2))
ControlMove ("Form1","", $Edit,$Ctr3,$GUICur-4,$Ctr3,$Ctr3-($GUICur-4-$Ctr3))
EndIf
EndIf
If $Ea1y1 And $Ea1y2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit,$Ctr1,$Ctr1,$Ctr1,$GUICur+4-$Ctr1)
ControlMove ("Form1","", $Edit,$Ctr2,$Ctr2,$Ctr2,$GUICur+4-$Ctr2)
ControlMove ("Form1","", $Edit,$Ctr3,$Ctr3,$Ctr3,$GUICur+4-$Ctr3)
ControlMove ("Form1","", $Edit,$Ctr4,$GUICur+8-4,$Ctr4,$Ctr4-($GUICur+8-4-$Ctr4))
ControlMove ("Form1","", $Edit,$Ctr5,$GUICur+8-4,$Ctr5,$Ctr5-($GUICur+8-4-$Ctr5))
ControlMove ("Form1","", $Edit,$Ctr6,$GUICur+8-4,$Ctr6,$Ctr6-($GUICur+8-4-$Ctr6))
EndIf
EndIf
If $Ra2x1 And $Ra2x2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit,$Ctr1,$Ctr1,$GUICur-8+4-$Ctr1,$Ctr1)
ControlMove ("Form1","", $Edit,$GUICur-4,$Ctr2,$Ctr2-($GUICur-4-$Ctr2),$Ctr2)
ControlMove ("Form1","", $Edit,$Ctr4,$Ctr4,$GUICur-8+4-$Ctr4,$Ctr4)
ControlMove ("Form1","", $Edit,$Ctr7,$Ctr7,$GUICur-8+4-$Ctr7,$Ctr7)
ControlMove ("Form1","", $Edit,$GUICur-4,$Ctr5,$Ctr5-($GUICur-4-$Ctr5),$Ctr5)
ControlMove ("Form1","", $Edit,$GUICur-4,$Ctr8,$Ctr8-($GUICur-4-$Ctr8),$Ctr8)
EndIf
EndIf
If $La2x1 And $La2x2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit,$Ctr2,$Ctr2,$GUICur+4-$Ctr2,$Ctr2)
ControlMove ("Form1","", $Edit,$Ctr5,$Ctr5,$GUICur+4-$Ctr5,$Ctr5)
ControlMove ("Form1","", $Edit,$Ctr8,$Ctr8,$GUICur+4-$Ctr8,$Ctr8)
ControlMove ("Form1","", $Edit,$GUICur+8-4,$Ctr3,$Ctr3-($GUICur+8-4-$Ctr3),$Ctr3)
ControlMove ("Form1","", $Edit,$GUICur+8-4,$Ctr6,$Ctr6-($GUICur+8-4-$Ctr6),$Ctr6)
ControlMove ("Form1","", $Edit,$GUICur+8-4,$Ctr9,$Ctr9-($GUICur+8-4-$Ctr9),$Ctr9)
EndIf
EndIf
If $Ra3x1 And $Ra3x2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit,$Ctr2,$Ctr2,$GUICur-8+4-$Ctr2,$Ctr2)
ControlMove ("Form1","", $Edit,$GUICur-4,$Ctr3,$Ctr3-($GUICur-4-$Ctr3),$Ctr3)
ControlMove ("Form1","", $Edit,$Ctr5,$Ctr5,$GUICur-8+4-$Ctr5,$Ctr5)
ControlMove ("Form1","", $Edit,$Ctr8,$Ctr8,$GUICur-8+4-$Ctr8,$Ctr8)
ControlMove ("Form1","", $Edit,$GUICur-4,$Ctr6,$Ctr6-($GUICur-4-$Ctr6),$Ctr6)
ControlMove ("Form1","", $Edit,$GUICur-4,$Ctr9,$Ctr9-($GUICur-4-$Ctr9),$Ctr9)
EndIf
EndIf
If $La3x1 And $La3x2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit,$Ctr3,$Ctr3,$GUICur+4-$Ctr3,$Ctr3)
ControlMove ("Form1","", $Edit,$Ctr6,$Ctr6,$GUICur+4-$Ctr6,$Ctr6)
ControlMove ("Form1","", $Edit,$Ctr9,$Ctr9,$GUICur+4-$Ctr9,$Ctr9)
EndIf
EndIf
If $Ta4y1 And $Ta4y2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit,$Ctr1,$Ctr1,$Ctr1,$GUICur-8+4-$Ctr1)
ControlMove ("Form1","", $Edit,$Ctr2,$Ctr2,$Ctr2,$GUICur-8+4-$Ctr2)
ControlMove ("Form1","", $Edit,$Ctr3,$Ctr3,$Ctr3,$GUICur-8+4-$Ctr3)
ControlMove ("Form1","", $Edit,$Ctr4,$GUICur-4,$Ctr4,$Ctr4-($GUICur-4-$Ctr4))
ControlMove ("Form1","", $Edit,$Ctr5,$GUICur-4,$Ctr5,$Ctr5-($GUICur-4-$Ctr5))
ControlMove ("Form1","", $Edit,$Ctr6,$GUICur-4,$Ctr6,$Ctr6-($GUICur-4-$Ctr6))
EndIf
EndIf
If $Ea4y1 And $Ea4y2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit,$Ctr4,$Ctr4,$Ctr4,$GUICur+4-$Ctr4)
ControlMove ("Form1","", $Edit,$Ctr5,$Ctr5,$Ctr5,$GUICur+4-$Ctr5)
ControlMove ("Form1","", $Edit,$Ctr6,$Ctr6,$Ctr6,$GUICur+4-$Ctr6)
ControlMove ("Form1","", $Edit,$Ctr7,$GUICur+8-4,$Ctr7,$Ctr7-($GUICur+8-4-$Ctr7))
ControlMove ("Form1","", $Edit,$Ctr8,$GUICur+8-4,$Ctr8,$Ctr8-($GUICur+8-4-$Ctr8))
ControlMove ("Form1","", $Edit,$Ctr9,$GUICur+8-4,$Ctr9,$Ctr9-($GUICur+8-4-$Ctr9))
EndIf
EndIf
If $Ta7y1 And $Ta7y2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit,$Ctr4,$Ctr4,$Ctr4,$GUICur-8+4-$Ctr4)
ControlMove ("Form1","", $Edit,$Ctr5,$Ctr5,$Ctr5,$GUICur-8+4-$Ctr5)
ControlMove ("Form1","", $Edit,$Ctr6,$Ctr6,$Ctr6,$GUICur-8+4-$Ctr6)
ControlMove ("Form1","", $Edit,$Ctr7,$GUICur-4,$Ctr7,$Ctr7-($GUICur-4-$Ctr7))
ControlMove ("Form1","", $Edit,$Ctr8,$GUICur-4,$Ctr8,$Ctr8-($GUICur-4-$Ctr8))
ControlMove ("Form1","", $Edit,$Ctr9,$GUICur-4,$Ctr9,$Ctr9-($GUICur-4-$Ctr9))
EndIf
EndIf
If $Ea7y1 And $Ea7y2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit,$Ctr7,$Ctr7,$Ctr7,$GUICur+4-$Ctr7)
ControlMove ("Form1","", $Edit,$Ctr8,$Ctr8,$Ctr8,$GUICur+4-$Ctr8)
ControlMove ("Form1","", $Edit,$Ctr9,$Ctr9,$Ctr9,$GUICur+4-$Ctr9)
EndIf
EndIf
EndFunc
Func CLOSEClicked()
GUIDelete($Form1)
Exit
EndFunc
求救啊~拜託各位高手....
页:
[1]