父子窗口中, 子窗口(美化)样式的问题(已解决)
本帖最后由 user3000 于 2012-3-23 15:08 编辑如标题, 下面代码如何达到父子看起来'和谐'美观点?
有图有码, 希望真相能尽快大白...
简略代码(完成后再放源码区...):#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Opt('GuiOnEventMode', 1)
Global $Title = '定时关机工具', $Command_Code = 0 ; 动作标志, 0 关机, 1 重启, 3 执行程序
Global $MainForm, $nMsg, $w = 388, $h = 137
Global $Week_Form, $ch_Box, $but, _
$box_Text = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期天'], _
$but_Text = ['查看计划', '加入计划', '删除计划', '执行计划']
Global $Radios, $R_Text = ['延时', '今日', '每日', '每周'], $R_id
Global $uRadios
Global $Plan_Form, $iHour, $iMin, $L_id, $view_Task, $Execute_Task
Global $iR_Text = ['关闭机器', '重启机器', '运行程序']
$MainForm = GUICreate($Title, $w, $h, -1, -1, -1, 0x00000100)
GUISetOnEvent(-3, '_Exit')
GUICtrlCreateGroup("模式选择", 32, 24, 329, 89, 0x0300); 文本居中
GUICtrlSetFont(-1, 12)
For $i = 0 To 3
$Radios[$i] = GUICtrlCreateRadio($R_Text[$i], 56 + $i * 76, 61, 55, 25)
;GUICtrlSetOnEvent(-1, '_Set_Mode')
GUICtrlSetFont(-1, 10)
Next
GUICtrlSetState($Radios, $GUI_CHECKED)
$R_id = 0
_Set_Plan()
GUISetState(@SW_SHOW, $MainForm)
GUISetState(@SW_SHOW, $Plan_Form)
While 1
Sleep(88)
WEnd
Func _Set_Plan()
$Plan_Form = GUICreate('', $w + 3, 100, -2, $h + 4, 0x80880000, 0x00000040, $MainForm) ; 样式 无标题, 建立于父窗口内
$iHour = GUICtrlCreateInput("0", 38, 16, 25, 21, BitOR(0x2000, 0x0002)) ;数字 右端显示
GUICtrlCreateLabel("时", 70, 20, 36, 17)
$iMin = GUICtrlCreateInput("5", 94, 16, 25, 21, BitOR(0x2000, 0x0002))
GUICtrlCreateLabel("分", 125, 20, 36, 17)
$L_id = GUICtrlCreateLabel('[' & $R_Text[$R_id] & ']', 165, 20, 36, 17)
For $i = 0 To 2
$uRadios[$i] = GUICtrlCreateRadio($iR_Text[$i], 35 + $i * 70, 55)
Next
GUICtrlSetState($uRadios, 1)
$view_Task = GUICtrlCreateButton('查看修改', 300, 18, 65, 22)
GUICtrlSetState(-1, $gui_focus)
$Execute_Task = GUICtrlCreateButton('执行计划', 300, 55, 65, 22)
EndFunc ;==>_Set_Plan
Func _Exit()
Exit
EndFunc ;==>_Exit现在效果图:
极不'和谐'吧?
有没子窗口用样式让它尽量和父窗口般配点...
或者有什么别的思路不? 再上个大点的, 跟桌面背景比较的图..
那凹痕和黑线更明显了...
要么主窗口也用无标题栏的细边框
要么不用子窗口,在同一窗口解决 本帖最后由 lixiaolong 于 2012-3-19 01:48 编辑
这样是不是好看点?
以前在论坛里看过的代码(win7测试)
_GUIRoundCorners($Plan_Form, 1, 3, 20, 20)
Func _GUIRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
Local $XS_pos, $XS_ret, $XS_ret2
$XS_pos = WinGetPos($h_win)
$XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos, "long", $XS_pos, "long", $i_x3, "long", $i_y3)
If $XS_ret Then
$XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret, "int", 1)
EndIf
EndFunc 本帖最后由 haijie1223 于 2012-3-19 08:59 编辑
回复 4# lixiaolong
不错 挺好看的,我也来一个:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Opt('GuiOnEventMode', 1)
Global $Title = '定时关机工具', $Command_Code = 0 ; 动作标志, 0 关机, 1 重启, 3 执行程序
Global $MainForm, $nMsg, $w = 388, $h = 137
Global $Week_Form, $ch_Box, $but, _
$box_Text = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期天'], _
$but_Text = ['查看计划', '加入计划', '删除计划', '执行计划']
Global $Radios, $R_Text = ['延时', '今日', '每日', '每周'], $R_id
Global $uRadios
Global $Plan_Form, $iHour, $iMin, $L_id, $view_Task, $Execute_Task
Global $iR_Text = ['关闭机器', '重启机器', '运行程序']
Global $sui
$MainForm = GUICreate($Title, $w, $h, -1, -1, -1, 0x00000100)
GUISetOnEvent(-3, '_Exit')
GUICtrlCreateGroup("模式选择", 32, 24, 329, 89, 0x0300); 文本居中
GUICtrlSetFont(-1, 12)
For $i = 0 To 3
$Radios[$i] = GUICtrlCreateRadio($R_Text[$i], 56 + $i * 76, 61, 55, 25)
;GUICtrlSetOnEvent(-1, '_Set_Mode')
GUICtrlSetFont(-1, 10)
Next
GUICtrlSetState($Radios, $GUI_CHECKED)
$R_id = 0
_Set_Plan()
GUISetState(@SW_SHOW, $MainForm)
GUISetState(@SW_SHOW, $Plan_Form)
While 1
move()
Sleep(200)
WEnd
Func _Set_Plan()
$Plan_Form = GUICreate('', $w, $h, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW)
$iHour = GUICtrlCreateInput("0", 38, 16, 25, 21, BitOR(0x2000, 0x0002)) ;数字 右端显示
GUICtrlCreateLabel("时", 70, 20, 36, 17)
$iMin = GUICtrlCreateInput("5", 94, 16, 25, 21, BitOR(0x2000, 0x0002))
GUICtrlCreateLabel("分", 125, 20, 36, 17)
$L_id = GUICtrlCreateLabel('[' & $R_Text[$R_id] & ']', 165, 20, 36, 17)
For $i = 0 To 2
$uRadios[$i] = GUICtrlCreateRadio($iR_Text[$i], 35 + $i * 70, 55)
Next
GUICtrlSetState($uRadios, 1)
$view_Task = GUICtrlCreateButton('查看修改', 300, 18, 65, 22)
GUICtrlSetState(-1, $gui_focus)
$Execute_Task = GUICtrlCreateButton('执行计划', 300, 55, 65, 22)
WinSetOnTop($Plan_Form, "", 1)
WinSetOnTop($MainForm, "", 1)
EndFunc ;==>_Set_Plan
Func move() ;跟随主窗口
Local $x = WinGetPos($MainForm)
Local $y = WinGetPos($Plan_Form)
If $y - ($x + $x) <> 0 Or $y - ($x + $x) <> 0 Then
WinMove($Plan_Form, "", $x, $x + $x)
EndIf
EndFunc ;==>move
Func _Exit()
Exit
EndFunc ;==>_Exit 本帖最后由 haijie1223 于 2012-3-19 09:17 编辑
如果下边的窗口有跟随卡顿的现象,请将38行的sleep值改小。 这个没有更好的解决方法吗?延长窗口不就行了吗? 回复 6# haijie1223
改成消息效果很好,不卡顿~
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Opt('GuiOnEventMode', 1)
Global $Title = '定时关机工具', $Command_Code = 0 ; 动作标志, 0 关机, 1 重启, 3 执行程序
Global $MainForm, $nMsg, $w = 388, $h = 137
Global $Week_Form, $ch_Box, $but, _
$box_Text = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期天'], _
$but_Text = ['查看计划', '加入计划', '删除计划', '执行计划']
Global $Radios, $R_Text = ['延时', '今日', '每日', '每周'], $R_id
Global $uRadios
Global $Plan_Form, $iHour, $iMin, $L_id, $view_Task, $Execute_Task
Global $iR_Text = ['关闭机器', '重启机器', '运行程序']
Global $sui
$MainForm = GUICreate($Title, $w, $h, -1, -1, -1, 0x00000100)
GUISetOnEvent(-3, '_Exit')
GUICtrlCreateGroup("模式选择", 32, 24, 329, 89, 0x0300); 文本居中
GUICtrlSetFont(-1, 12)
For $i = 0 To 3
$Radios[$i] = GUICtrlCreateRadio($R_Text[$i], 56 + $i * 76, 61, 55, 25)
;GUICtrlSetOnEvent(-1, '_Set_Mode')
GUICtrlSetFont(-1, 10)
Next
GUICtrlSetState($Radios, $GUI_CHECKED)
$R_id = 0
_Set_Plan()
GUISetState(@SW_SHOW, $MainForm)
GUISetState(@SW_SHOW, $Plan_Form)
;添加的值
GUIRegisterMsg($WM_MOVE, "WM_MOVE")
While 1
Sleep(200)
WEnd
Func _Set_Plan()
$Plan_Form = GUICreate('', $w, $h, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW)
$iHour = GUICtrlCreateInput("0", 38, 16, 25, 21, BitOR(0x2000, 0x0002)) ;数字 右端显示
GUICtrlCreateLabel("时", 70, 20, 36, 17)
$iMin = GUICtrlCreateInput("5", 94, 16, 25, 21, BitOR(0x2000, 0x0002))
GUICtrlCreateLabel("分", 125, 20, 36, 17)
$L_id = GUICtrlCreateLabel('[' & $R_Text[$R_id] & ']', 165, 20, 36, 17)
For $i = 0 To 2
$uRadios[$i] = GUICtrlCreateRadio($iR_Text[$i], 35 + $i * 70, 55)
Next
GUICtrlSetState($uRadios, 1)
$view_Task = GUICtrlCreateButton('查看修改', 300, 18, 65, 22)
GUICtrlSetState(-1, $gui_focus)
$Execute_Task = GUICtrlCreateButton('执行计划', 300, 55, 65, 22)
WinSetOnTop($Plan_Form, "", 1)
WinSetOnTop($MainForm, "", 1)
;添加的值
Local $pos = WinGetPos($MainForm)
WinMove($Plan_Form, "", $pos, $pos + $pos)
EndFunc ;==>_Set_Plan
;添加的值
Func WM_MOVE($hWnd, $Msg, $wParam, $lParam)
Local $x = WinGetPos($MainForm)
Local $y = WinGetPos($Plan_Form)
If $y - ($x + $x) <> 0 Or $y - ($x + $x) <> 0 Then
WinMove($Plan_Form, "", $x, $x + $x)
EndIf
EndFunc
Func _Exit()
Exit
EndFunc ;==>_Exit
没必要用子窗口啊,怪了,要用象我这样放里面不就行了
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Opt('GuiOnEventMode', 1)
Global $Title = '定时关机工具', $Command_Code = 0 ; 动作标志, 0 关机, 1 重启, 3 执行程序
Global $MainForm, $nMsg, $w = 388, $h = 237
Global $Week_Form, $ch_Box, $but, _
$box_Text = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期天'], _
$but_Text = ['查看计划', '加入计划', '删除计划', '执行计划']
Global $Radios, $R_Text = ['延时', '今日', '每日', '每周'], $R_id
Global $uRadios
Global $Plan_Form, $iHour, $iMin, $L_id, $view_Task, $Execute_Task
Global $iR_Text = ['关闭机器', '重启机器', '运行程序']
$MainForm = GUICreate($Title, $w, $h, -1, -1, -1, 0x00000100)
GUISetOnEvent(-3, '_Exit')
GUICtrlCreateGroup("模式选择", 32, 24, 329, 89, 0x0300); 文本居中
GUICtrlSetFont(-1, 12)
For $i = 0 To 3
$Radios[$i] = GUICtrlCreateRadio($R_Text[$i], 56 + $i * 76, 61, 55, 25)
;GUICtrlSetOnEvent(-1, '_Set_Mode')
GUICtrlSetFont(-1, 10)
Next
GUICtrlSetState($Radios, $GUI_CHECKED)
$R_id = 0
_Set_Plan()
GUISetState(@SW_SHOW, $MainForm)
GUISetState(@SW_SHOW, $Plan_Form)
While 1
Sleep(88)
WEnd
Func _Set_Plan()
$Plan_Form = GUICreate('', $w , 100, 0, $h -100, 0x80000000, 0x00000040, $MainForm) ; 样式 无标题, 建立于父窗口内
$iHour = GUICtrlCreateInput("0", 38, 16, 25, 21, BitOR(0x2000, 0x0002)) ;数字 右端显示
GUICtrlCreateLabel("时", 70, 20, 36, 17)
$iMin = GUICtrlCreateInput("5", 94, 16, 25, 21, BitOR(0x2000, 0x0002))
GUICtrlCreateLabel("分", 125, 20, 36, 17)
$L_id = GUICtrlCreateLabel('[' & $R_Text[$R_id] & ']', 165, 20, 36, 17)
For $i = 0 To 2
$uRadios[$i] = GUICtrlCreateRadio($iR_Text[$i], 35 + $i * 70, 55)
Next
GUICtrlSetState($uRadios, 1)
$view_Task = GUICtrlCreateButton('查看修改', 300, 18, 65, 22)
GUICtrlSetState(-1, $gui_focus)
$Execute_Task = GUICtrlCreateButton('执行计划', 300, 55, 65, 22)
EndFunc ;==>_Set_Plan
Func _Exit()
Exit
EndFunc ;==>_Exit 9楼的可以。 论坛搜索she皮肤不是就可以吗? 回复 9# seniors
这个同等窗口 很不错 楼主要的是每选择一个按钮出现相应的菜单。。。。。。 楼主要的是每选择一个按钮出现相应的菜单。。。。。。
卫和谐 发表于 2012-3-19 14:45 http://www.autoitx.com/images/common/back.gif
正是, 如果同一窗口, 当以星期来做计划任务的话,
窗口几乎要全部绘制吧? 正是, 如果同一窗口, 当以星期来做计划任务的话,
窗口几乎要全部绘制吧?
user3000 发表于 2012-3-19 15:47 http://www.autoitx.com/images/common/back.gif
真是如此,更没必要外面拖个子窗口了~
TAB 选项卡、内嵌子窗口的显隐、甚至控件组的显隐都可以完成这个简单的要求
页:
[1]
2