[已解决]如何能使窗口暂时改变样式,返回样式后原样式不变
本帖最后由 天堂泪吻泪 于 2010-9-19 16:21 编辑我想让一个窗口暂时置顶,但试了很多方法都试不出来!都快疯了!
希望大大们帮在下改一下!{:face (319):}#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 320, 237,-1, -1, -1, $WS_EX_ACCEPTFILES)
$Checkbox1 = GUICtrlCreateCheckbox("置顶", 80, 96 )
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox1
If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
GUISetStyle(-1, BitOR($WS_EX_TOPMOST, $WS_EX_ACCEPTFILES),$Form1 )
;~ WinSetOnTop("Form1","",1)
GUISetStyle(Default, $WS_EX_TOPMOST, $Form1)
;~ MsgBox(0, "", "TOP")
ElseIf GUICtrlRead($Checkbox1) = $gui_UNchecked Then
;~ WinSetOnTop("Form1","",0)
GUISetStyle(-1, $WS_EX_ACCEPTFILES,$Form1 )
;~ MsgBox(0, "", "NOTOP")
EndIf
EndSwitch
WEnd
你不是已经WinSetOnTop试过了,应该就行了 WinSetOnTop($Form1, "", 1)这样应该就可以了,你试下 本帖最后由 afan 于 2010-9-18 23:27 编辑
莫非素这个意思?
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 320, 237)
$Checkbox1 = GUICtrlCreateCheckbox("置顶", 80, 95)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $Checkbox1
If GUICtrlRead($Checkbox1) = 1 Then
WinSetOnTop("Form1", "", 1)
GUISetStyle(-1, $WS_EX_ACCEPTFILES)
ElseIf GUICtrlRead($Checkbox1) = 4 Then
WinSetOnTop("Form1", "", 0)
GUISetStyle(-1, 0)
EndIf
EndSwitch
WEnd
回复 4# afan
OK了!受到你的启发
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 320, 237,-1,-1,-1,$WS_EX_ACCEPTFILES)
$Checkbox1 = GUICtrlCreateCheckbox("置顶", 80, 95)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $Checkbox1
If GUICtrlRead($Checkbox1) = 1 Then
WinSetOnTop("Form1", "", 1)
GUISetStyle(-1, $WS_EX_ACCEPTFILES)
ElseIf GUICtrlRead($Checkbox1) = 4 Then
WinSetOnTop("Form1", "", 0)
GUISetStyle(-1, $WS_EX_ACCEPTFILES)
EndIf
EndSwitch
WEnd
本帖最后由 afan 于 2010-9-19 16:51 编辑
回复afan
OK了!受到你的启发
天堂泪吻泪 发表于 2010-9-19 16:04 http://www.autoitx.com/images/common/back.gif
为什么给你启发成这样了呢? 你这样不是从头到脚都没改变样式吗? 要GUISetStyle作甚… 回复 6# afan
本来,我是想做个文件拖动的,刚刚开始是可以,但当我想暂时置顶的时候,顶是置了,但是$WS_EX_ACCEPTFILES没了,$WS_EX_ACCEPTFILES有了,但不能置顶!!!很晕!{:face (229):}
页:
[1]