(已解决)GUI 样式表 和 关闭按钮 以及 Radiobox check的问题
本帖最后由 yarsye 于 2010-8-24 10:46 编辑情况是这样子的
问题 1 :开始我只用GuiCreate 没用样式表 , 关闭按钮是可以出来而且可以用 , 之后就不能出来和不能关闭了 。我试了把样式表拿掉就好了 , 而且 加了样式表后 GUI界面就不可以移动了 , 很奇怪。
问题 2 :为什么这个Radiobox 不可以多选 ?只能选择一个 !我差看了许久 ,不知道问题出在哪 ,望高手解救 。
感谢您的阅读 。#include <GuiEdit.au3>
#include <Screencapture.au3>
#include <file.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Global $Formtitle=" Installation ", $Ver = '1.0'
Global $boxleft = 30
Local $Form, $box1, $msg, $button1, $box2, $box3, $ch
$ch = 0
$Form1_1 = GUICreate($Formtitle , 421, 387, 193, 125,BitOR ($WS_TABSTOP , $WS_POPUP) )
GUISetCursor (0)
GUISetFont(10, 800, 0, "MS Sans Serif")
GUISetBkColor(0xD8E4F8)
GUICtrlCreateLabel($Formtitle , 120, 10, 500, 33);Please select the Setup.exe Through OK Button.
$Radio1 = GUICtrlCreateRadio("", 80, 48, 33, 49)
GUICtrlSetCursor (-1, 0)
$Radio2 = GUICtrlCreateRadio("", 80, 88, 33, 49)
GUICtrlSetCursor (-1, 0)
$Radio3 = GUICtrlCreateRadio("", 80, 128, 33, 49)
GUICtrlSetCursor (-1, 0)
$Radio4 = GUICtrlCreateRadio("", 80, 168, 33, 49)
GUICtrlSetCursor (-1, 0)
$Radio5 = GUICtrlCreateRadio("", 80, 208, 33, 49)
GUICtrlSetCursor (-1, 0)
$Button1 = GUICtrlCreateButton("A", 128, 58, 200, 25, 0)
GUICtrlSetCursor (-1, 0)
$Button2 = GUICtrlCreateButton("B", 128, 98, 200, 25, 0)
GUICtrlSetCursor (-1, 0)
$Button3 = GUICtrlCreateButton("C", 128, 138, 200, 25, 0)
GUICtrlSetCursor (-1, 0)
$Button4 = GUICtrlCreateButton("D", 128, 182, 200, 25, 0)
GUICtrlSetCursor (-1, 0)
$Button5 = GUICtrlCreateButton("E", 128, 224, 200, 25, 0)
GUICtrlSetCursor (-1, 0)
$Radio6 = GUICtrlCreateRadio("", 80, 248, 33, 49)
GUICtrlSetCursor (-1, 0)
$Button6 = GUICtrlCreateButton("F", 128, 264, 200, 25, 0)
GUICtrlSetCursor (-1, 0)
$Button7 = GUICtrlCreateButton("OK", 140, 304, 150, 33, 0);left, top , width , height
GUICtrlSetBkColor(-1, 0xFFFF00)
$Group1 = GUICtrlCreateGroup("", 48, 40, 337, 257)
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")
GUICtrlSetOnEvent($Button7 , "Button1Event")
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $button7
Radio_check()
EndSelect
WEnd
Func Radio_check()
For $i = 1 To 5
$ch = "Radio" & $i
If GUICtrlRead(Eval($ch)) = $GUI_UNCHECKED Then
MsgBox(0, 0, $ch & 'unchecked')
EndIf
If GUICtrlRead(Eval($ch)) = $GUI_CHECKED Then
;Call($ch)
MsgBox(0, 0, $ch & 'checked')
EndIf
Next
EndFunc
Func _Exit()
Exit
EndFunc
Func Button1Event()
Local $Button1Fun
Local $hEdit1
$Button1Fun=FileOpenDialog("Browse the file",@WindowsDir & "","All(*.*)");Finding Browse file Location
;$hEdit1=ControlGetHandle("","",14);deal with file
;_GUICtrlEdit_setText($hEdit1,$Button1Fun)
ShellExecute($Button1Fun)
EndFunc 1.请把样式改成$Form1_1 = GUICreate($Formtitle , 421, 387, 193, 125 ,BitOR ($WS_TABSTOP , $WS_POPUP,$WS_MINIMIZEBOX,$WS_CAPTION,$WS_POPUP,$WS_SYSMENU))2.多选为什么不用GUICtrlCreateCheckbox gui学习中, guicreate 回复 2# ivanpg
你的建议我已收到 感谢你的回复
但是1.对于那个头部 我觉得不太好看 要是能拿掉或者换种模样 同时能移动 AND 最大化最小化 按钮也都在 那就完美了 ,估计这样的话 只能改变顶部框的样式吧
2.换成checkbox后 是可以多选 ,但是不完美的是 有个虚线框 。我试了那个guictrlcreateradio也有那个虚线框 ,不太好看。
发现个新问题 点击Star按钮有问题 本帖最后由 131738 于 2010-8-22 18:01 编辑
这个 http://www.autoitx.com/thread-17587-1-1.html 的窗口就是自己添加标题栏,并自添加关闭 “ X”符号按钮的
你可以用你的
GUICtrlCreateLabel($Formtitle , 120, 10, 500, 33);Please select the Setup.exe Through OK Button. 这个标签修改,
“ X “符号能自添加,最大、最小也应该可以吧,只是分析那个代码费事点。。。。 Radiobox 这个本来就叫单选框吧。。。。。 $Label0 = GUICtrlCreateLabel ( "X", 410, 0, 50, 50)
GUICtrlSetOnEvent ( $Label0, "_Exit" )这样就可以退出了 GUICtrlCreateLabel($Formtitle , 120, 10, 200, 33,"",$GUI_WS_EX_PARENTDRAG)这样就可以移动了 回复 9# 131738
哇 !!!!
您太有才了!!!!
爱死你了!!!
崇拜中。。。。。 回复 8# 131738
我又看了一遍 Help File 找到了 “扩展样式 $GUI_WS_EX_PARENTDRAG 可以允许拖动没有标题栏的父窗口 (也就是创建的 GUI 没有 $WS_CAPTION 样式). ” 我也没用 $ws-caption样式啊 , 可是还是不能拖动 。
$Form1_1 = GUICreate($Formtitle , 421, 387, 193, 125, $WS_POPUP)
GUICtrlCreateLabel($Formtitle , 120, 10, 200, 33,"",$GUI_WS_EX_PARENTDRAG)
这样在我机器上试了很多次 都不行不知道为什么 回复 11# yarsye
“扩展样式 $GUI_WS_EX_PARENTDRAG 可以允许拖动没有标题栏的父窗口 (也就是创建的 GUI 没有 $WS_CAPTION 样式). ”
原文为“Allow the label or pic control to be used as the title bar to drag the whole the parent window.”金山翻译为“允许标签或PIC控件作为标题栏拖动整个父窗口”,没有你说的后半句啊。。。 回复 11# yarsye
要按住标签才能拖动的。。。 回复 12# 131738
我那个后半句是从帮助文档里看到的你在帮助文档搜索里输入 GUICtrlCreateLabel看下面的注释就可以找到 回复131738
我那个后半句是从帮助文档里看到的你在帮助文档搜索里输入 GUICtrlCreateLabel看 ...
yarsye 发表于 2010-8-23 13:59 http://www.autoitx.com/images/common/back.gif
以样式列表的说明为准吧。。。。。
页:
[1]
2