#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
Opt("GUIOnEventMode", 1)
Local $Edit[100][100],$Hount=3,$WCount=3,$Ctr[10][10],$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[2] = 1 Then
lashen()
EndIf
WEnd
Func lashen()
$k = 1
$Ctr1 = ControlGetPos("Form1","",$Edit[1][1]) ;控件信息
$Ctr2 = ControlGetPos("Form1","",$Edit[2][1])
$Ctr3 = ControlGetPos("Form1","",$Edit[3][1])
$Ctr4 = ControlGetPos("Form1","",$Edit[1][2])
$Ctr5 = ControlGetPos("Form1","",$Edit[2][2])
$Ctr6 = ControlGetPos("Form1","",$Edit[3][2])
$Ctr7 = ControlGetPos("Form1","",$Edit[1][3])
$Ctr8 = ControlGetPos("Form1","",$Edit[2][3])
$Ctr9 = ControlGetPos("Form1","",$Edit[3][3])
$nPos = WinGetPos("Form1") ;主窗信息
;-------------------------------------------------------------------------------右边
$La1x1 = ($GUICur[0] > $Ctr1[0] + $Ctr1[2]- 8)
$La1x2 = ($GUICur[0] < $Ctr1[0] + $Ctr1[2])
$La2x1 = ($GUICur[0] > $Ctr2[0] + $Ctr2[2]- 8)
$La2x2 = ($GUICur[0] < $Ctr2[0] + $Ctr2[2])
$La3x1 = ($GUICur[0] > $Ctr3[0] + $Ctr3[2]- 8)
$La3x2 = ($GUICur[0] < $Ctr3[0] + $Ctr3[2])
;--------------------------------------------------------------------------------左边
$Ra1x1 = ($GUICur[0] < $Ctr1[0]+ 8)
$Ra1x2 = ($GUICur[0] > $Ctr1[0])
$Ra2x1 = ($GUICur[0] < $Ctr2[0]+ 8)
$Ra2x2 = ($GUICur[0] > $Ctr2[0])
$Ra3x1 = ($GUICur[0] < $Ctr3[0]+ 8)
$Ra3x2 = ($GUICur[0] > $Ctr3[0])
;------------------------------------------------------------------------------ 上边
$Ta1y1 = ($GUICur[1] < $Ctr1[1]+ 8)
$Ta1y2 = ($GUICur[1] > $Ctr1[1])
$Ta4y1 = ($GUICur[1] < $Ctr4[1]+ 8)
$Ta4y2 = ($GUICur[1] > $Ctr4[1])
$Ta7y1 = ($GUICur[1] < $Ctr7[1]+ 8)
$Ta7y2 = ($GUICur[1] > $Ctr7[1])
;------------------------------------------------------------------------------下边
$Ea1y1 = ($GUICur[1] > $Ctr1[1] + $Ctr1[3]- 8)
$Ea1y2 = ($GUICur[1] < $Ctr1[1] + $Ctr1[3])
$Ea4y1 = ($GUICur[1] > $Ctr4[1] + $Ctr4[3]- 8)
$Ea4y2 = ($GUICur[1] < $Ctr4[1] + $Ctr4[3])
$Ea7y1 = ($GUICur[1] > $Ctr7[1] + $Ctr7[3]- 8)
$Ea7y2 = ($GUICur[1] < $Ctr7[1] + $Ctr7[3])
;------------------------------------------------------------------------------
If $La1x1 And $La1x2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit[1][1],$Ctr1[0],$Ctr1[1],$GUICur[0]+4-$Ctr1[0],$Ctr1[3])
ControlMove ("Form1","", $Edit[1][2],$Ctr4[0],$Ctr4[1],$GUICur[0]+4-$Ctr4[0],$Ctr4[3])
ControlMove ("Form1","", $Edit[1][3],$Ctr7[0],$Ctr7[1],$GUICur[0]+4-$Ctr7[0],$Ctr7[3])
ControlMove ("Form1","", $Edit[2][1],$GUICur[0]+8-4,$Ctr2[1],$Ctr2[2]-($GUICur[0]+8-4-$Ctr2[0]),$Ctr2[3])
ControlMove ("Form1","", $Edit[2][2],$GUICur[0]+8-4,$Ctr5[1],$Ctr5[2]-($GUICur[0]+8-4-$Ctr5[0]),$Ctr5[3])
ControlMove ("Form1","", $Edit[2][3],$GUICur[0]+8-4,$Ctr8[1],$Ctr8[2]-($GUICur[0]+8-4-$Ctr8[0]),$Ctr8[3])
EndIf
EndIf
If $Ra1x1 And $Ra1x2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit[1][1],$GUICur[0]-4,$Ctr1[1],$Ctr1[2]-($GUICur[0]-4-$Ctr1[0]),$Ctr1[3])
ControlMove ("Form1","", $Edit[1][2],$GUICur[0]-4,$Ctr4[1],$Ctr4[2]-($GUICur[0]-4-$Ctr4[0]),$Ctr4[3])
ControlMove ("Form1","", $Edit[1][3],$GUICur[0]-4,$Ctr7[1],$Ctr7[2]-($GUICur[0]-4-$Ctr7[0]),$Ctr7[3])
EndIf
EndIf
If $Ta1y1 And $Ta1y2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit[1][1],$Ctr1[0],$GUICur[1]-4,$Ctr1[2],$Ctr1[3]-($GUICur[1]-4-$Ctr1[1]))
ControlMove ("Form1","", $Edit[2][1],$Ctr2[0],$GUICur[1]-4,$Ctr2[2],$Ctr2[3]-($GUICur[1]-4-$Ctr2[1]))
ControlMove ("Form1","", $Edit[3][1],$Ctr3[0],$GUICur[1]-4,$Ctr3[2],$Ctr3[3]-($GUICur[1]-4-$Ctr3[1]))
EndIf
EndIf
If $Ea1y1 And $Ea1y2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit[1][1],$Ctr1[0],$Ctr1[1],$Ctr1[2],$GUICur[1]+4-$Ctr1[1])
ControlMove ("Form1","", $Edit[2][1],$Ctr2[0],$Ctr2[1],$Ctr2[2],$GUICur[1]+4-$Ctr2[1])
ControlMove ("Form1","", $Edit[3][1],$Ctr3[0],$Ctr3[1],$Ctr3[2],$GUICur[1]+4-$Ctr3[1])
ControlMove ("Form1","", $Edit[1][2],$Ctr4[0],$GUICur[1]+8-4,$Ctr4[2],$Ctr4[3]-($GUICur[1]+8-4-$Ctr4[1]))
ControlMove ("Form1","", $Edit[2][2],$Ctr5[0],$GUICur[1]+8-4,$Ctr5[2],$Ctr5[3]-($GUICur[1]+8-4-$Ctr5[1]))
ControlMove ("Form1","", $Edit[3][2],$Ctr6[0],$GUICur[1]+8-4,$Ctr6[2],$Ctr6[3]-($GUICur[1]+8-4-$Ctr6[1]))
EndIf
EndIf
If $Ra2x1 And $Ra2x2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit[1][1],$Ctr1[0],$Ctr1[1],$GUICur[0]-8+4-$Ctr1[0],$Ctr1[3])
ControlMove ("Form1","", $Edit[2][1],$GUICur[0]-4,$Ctr2[1],$Ctr2[2]-($GUICur[0]-4-$Ctr2[0]),$Ctr2[3])
ControlMove ("Form1","", $Edit[1][2],$Ctr4[0],$Ctr4[1],$GUICur[0]-8+4-$Ctr4[0],$Ctr4[3])
ControlMove ("Form1","", $Edit[1][3],$Ctr7[0],$Ctr7[1],$GUICur[0]-8+4-$Ctr7[0],$Ctr7[3])
ControlMove ("Form1","", $Edit[2][2],$GUICur[0]-4,$Ctr5[1],$Ctr5[2]-($GUICur[0]-4-$Ctr5[0]),$Ctr5[3])
ControlMove ("Form1","", $Edit[2][3],$GUICur[0]-4,$Ctr8[1],$Ctr8[2]-($GUICur[0]-4-$Ctr8[0]),$Ctr8[3])
EndIf
EndIf
If $La2x1 And $La2x2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit[2][1],$Ctr2[0],$Ctr2[1],$GUICur[0]+4-$Ctr2[0],$Ctr2[3])
ControlMove ("Form1","", $Edit[2][2],$Ctr5[0],$Ctr5[1],$GUICur[0]+4-$Ctr5[0],$Ctr5[3])
ControlMove ("Form1","", $Edit[2][3],$Ctr8[0],$Ctr8[1],$GUICur[0]+4-$Ctr8[0],$Ctr8[3])
ControlMove ("Form1","", $Edit[3][1],$GUICur[0]+8-4,$Ctr3[1],$Ctr3[2]-($GUICur[0]+8-4-$Ctr3[0]),$Ctr3[3])
ControlMove ("Form1","", $Edit[3][2],$GUICur[0]+8-4,$Ctr6[1],$Ctr6[2]-($GUICur[0]+8-4-$Ctr6[0]),$Ctr6[3])
ControlMove ("Form1","", $Edit[3][3],$GUICur[0]+8-4,$Ctr9[1],$Ctr9[2]-($GUICur[0]+8-4-$Ctr9[0]),$Ctr9[3])
EndIf
EndIf
If $Ra3x1 And $Ra3x2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit[2][1],$Ctr2[0],$Ctr2[1],$GUICur[0]-8+4-$Ctr2[0],$Ctr2[3])
ControlMove ("Form1","", $Edit[3][1],$GUICur[0]-4,$Ctr3[1],$Ctr3[2]-($GUICur[0]-4-$Ctr3[0]),$Ctr3[3])
ControlMove ("Form1","", $Edit[2][2],$Ctr5[0],$Ctr5[1],$GUICur[0]-8+4-$Ctr5[0],$Ctr5[3])
ControlMove ("Form1","", $Edit[2][3],$Ctr8[0],$Ctr8[1],$GUICur[0]-8+4-$Ctr8[0],$Ctr8[3])
ControlMove ("Form1","", $Edit[3][2],$GUICur[0]-4,$Ctr6[1],$Ctr6[2]-($GUICur[0]-4-$Ctr6[0]),$Ctr6[3])
ControlMove ("Form1","", $Edit[3][3],$GUICur[0]-4,$Ctr9[1],$Ctr9[2]-($GUICur[0]-4-$Ctr9[0]),$Ctr9[3])
EndIf
EndIf
If $La3x1 And $La3x2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit[3][1],$Ctr3[0],$Ctr3[1],$GUICur[0]+4-$Ctr3[0],$Ctr3[3])
ControlMove ("Form1","", $Edit[3][2],$Ctr6[0],$Ctr6[1],$GUICur[0]+4-$Ctr6[0],$Ctr6[3])
ControlMove ("Form1","", $Edit[3][3],$Ctr9[0],$Ctr9[1],$GUICur[0]+4-$Ctr9[0],$Ctr9[3])
EndIf
EndIf
If $Ta4y1 And $Ta4y2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit[1][1],$Ctr1[0],$Ctr1[1],$Ctr1[2],$GUICur[1]-8+4-$Ctr1[1])
ControlMove ("Form1","", $Edit[2][1],$Ctr2[0],$Ctr2[1],$Ctr2[2],$GUICur[1]-8+4-$Ctr2[1])
ControlMove ("Form1","", $Edit[3][1],$Ctr3[0],$Ctr3[1],$Ctr3[2],$GUICur[1]-8+4-$Ctr3[1])
ControlMove ("Form1","", $Edit[1][2],$Ctr4[0],$GUICur[1]-4,$Ctr4[2],$Ctr4[3]-($GUICur[1]-4-$Ctr4[1]))
ControlMove ("Form1","", $Edit[2][2],$Ctr5[0],$GUICur[1]-4,$Ctr5[2],$Ctr5[3]-($GUICur[1]-4-$Ctr5[1]))
ControlMove ("Form1","", $Edit[3][2],$Ctr6[0],$GUICur[1]-4,$Ctr6[2],$Ctr6[3]-($GUICur[1]-4-$Ctr6[1]))
EndIf
EndIf
If $Ea4y1 And $Ea4y2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit[1][2],$Ctr4[0],$Ctr4[1],$Ctr4[2],$GUICur[1]+4-$Ctr4[1])
ControlMove ("Form1","", $Edit[2][2],$Ctr5[0],$Ctr5[1],$Ctr5[2],$GUICur[1]+4-$Ctr5[1])
ControlMove ("Form1","", $Edit[3][2],$Ctr6[0],$Ctr6[1],$Ctr6[2],$GUICur[1]+4-$Ctr6[1])
ControlMove ("Form1","", $Edit[1][3],$Ctr7[0],$GUICur[1]+8-4,$Ctr7[2],$Ctr7[3]-($GUICur[1]+8-4-$Ctr7[1]))
ControlMove ("Form1","", $Edit[2][3],$Ctr8[0],$GUICur[1]+8-4,$Ctr8[2],$Ctr8[3]-($GUICur[1]+8-4-$Ctr8[1]))
ControlMove ("Form1","", $Edit[3][3],$Ctr9[0],$GUICur[1]+8-4,$Ctr9[2],$Ctr9[3]-($GUICur[1]+8-4-$Ctr9[1]))
EndIf
EndIf
If $Ta7y1 And $Ta7y2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit[1][2],$Ctr4[0],$Ctr4[1],$Ctr4[2],$GUICur[1]-8+4-$Ctr4[1])
ControlMove ("Form1","", $Edit[2][2],$Ctr5[0],$Ctr5[1],$Ctr5[2],$GUICur[1]-8+4-$Ctr5[1])
ControlMove ("Form1","", $Edit[3][2],$Ctr6[0],$Ctr6[1],$Ctr6[2],$GUICur[1]-8+4-$Ctr6[1])
ControlMove ("Form1","", $Edit[1][3],$Ctr7[0],$GUICur[1]-4,$Ctr7[2],$Ctr7[3]-($GUICur[1]-4-$Ctr7[1]))
ControlMove ("Form1","", $Edit[2][3],$Ctr8[0],$GUICur[1]-4,$Ctr8[2],$Ctr8[3]-($GUICur[1]-4-$Ctr8[1]))
ControlMove ("Form1","", $Edit[3][3],$Ctr9[0],$GUICur[1]-4,$Ctr9[2],$Ctr9[3]-($GUICur[1]-4-$Ctr9[1]))
EndIf
EndIf
If $Ea7y1 And $Ea7y2 Then
If $k = 1 Then
ControlMove ("Form1","", $Edit[1][3],$Ctr7[0],$Ctr7[1],$Ctr7[2],$GUICur[1]+4-$Ctr7[1])
ControlMove ("Form1","", $Edit[2][3],$Ctr8[0],$Ctr8[1],$Ctr8[2],$GUICur[1]+4-$Ctr8[1])
ControlMove ("Form1","", $Edit[3][3],$Ctr9[0],$Ctr9[1],$Ctr9[2],$GUICur[1]+4-$Ctr9[1])
EndIf
EndIf
EndFunc
Func CLOSEClicked()
GUIDelete($Form1)
Exit
EndFunc