关于第二个FORM问题
#include <GUIConstantsEx.au3>#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("test", 303, 339, 321, 178)
$ListView1 = GUICtrlCreateListView("键值 |值", 0, 8, 289, 273)
$button = GUICtrlCreateButton("Yes", 25, 290, 80, 40)
$delete = GUICtrlCreateButton("删除", 115, 290, 80, 40)
$add = GUICtrlCreateButton("添加", 205, 290, 80, 40)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $button
;Exit
Case $delete
;del()
Case $add
add()
EndSwitch
WEnd
Func add()
$Form1 = GUICreate("添加注册表启动项目", 215, 110, 309, 283)
$Label1 = GUICtrlCreateLabel("注册表项", 8, 20, 52, 17)
GUICtrlCreateInput("", 64, 16, 137, 21)
$Label2 = GUICtrlCreateLabel("项 值", 8, 45, 52, 17)
GUICtrlCreateInput("", 64, 40, 137, 21)
$Button1 = GUICtrlCreateButton("确定", 48, 80, 75, 25, 0)
$Button2 = GUICtrlCreateButton("取消", 136, 80, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
Exit
EndSwitch
WEnd
EndFunc
请问点击$add出来的窗体,点关闭就把整个程序都退出了?我是想关闭点击出来的窗体,而不关闭主窗体。
如何设置$ListView1 = GUICtrlCreateListView("键值|值", 0, 8, 289, 273)"值"的宽度?_GUICtrlListView_SetColumnWidth($ListView1, 0, 75)这个可以设置"键值"的宽度。
[ 本帖最后由 xg911335 于 2008-10-26 16:33 编辑 ] GUIDelete() $Form1 = GUICreate("test", 303, 339, 321, 178)
$ListView1 = GUICtrlCreateListView("键值 |值", 0, 8, 289, 273)
$button = GUICtrlCreateButton("Yes", 25, 290, 80, 40)
$delete = GUICtrlCreateButton("删除", 115, 290, 80, 40)
$add = GUICtrlCreateButton("添加", 205, 290, 80, 40)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUIDelete($Form1);;;;;;;;;;;;;;;;怎么这个关闭不了??
Case $button
;Exit
Case $delete
;del()
Case $add
add()
EndSwitch
WEnd
Func add()
$Form2 = GUICreate("添加注册表启动项目", 215, 110, 309, 283)
$Label1 = GUICtrlCreateLabel("注册表项", 8, 20, 52, 17)
GUICtrlCreateInput("", 64, 16, 137, 21)
$Label2 = GUICtrlCreateLabel("项 值", 8, 45, 52, 17)
GUICtrlCreateInput("", 64, 40, 137, 21)
$Button1 = GUICtrlCreateButton("确定", 48, 80, 75, 25, 0)
$Button2 = GUICtrlCreateButton("取消", 136, 80, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUIDelete($Form2);;;;;;;;;;;;;;;;;;;这里也有一个
Case $Button2
Exit
EndSwitch
WEnd
EndFunc
GUIDelete($Form1);;;;;;;;;;;;;;;;怎么这个关闭不了??
[ 本帖最后由 xg911335 于 2008-10-26 11:55 编辑 ] 交换一下句柄,要关闭子窗体时,必须先激活主窗体,先把焦点转到主窗体上 不好意思。我不是太理解。能给出代码吧。看代码比较容易理解。谢谢。 guiswitch($form1)
guidelete($form2)
guisetstate(-1,@gui_show)
记得不是很清楚,大概如此吧
还有,如果你要用case $nmsg的话,这么用不行,一定要带参数,$nMsg(1),否则程序自己判断不出来,你的这个nmsg是哪个界面上的
[ 本帖最后由 netegg 于 2008-10-26 14:32 编辑 ] GUISetState(@SW_HIDE, $Form2)
GUISetState(@SW_ENABLE, $Form1)
WinActivate("test")
谢谢。问题已解决。
页:
[1]