找回密码
 加入
搜索
查看: 4075|回复: 6

[GUI管理] [已解决]如何能使窗口暂时改变样式,返回样式后原样式不变

  [复制链接]
发表于 2010-9-18 22:27:15 | 显示全部楼层 |阅读模式
本帖最后由 天堂泪吻泪 于 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

评分

参与人数 1金钱 +10 收起 理由
afan + 10 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

发表于 2010-9-18 22:54:50 | 显示全部楼层
你不是已经WinSetOnTop试过了,应该就行了
发表于 2010-9-18 23:13:11 | 显示全部楼层
WinSetOnTop($Form1, "", 1)
这样应该就可以了,你试下
发表于 2010-9-18 23:17:40 | 显示全部楼层
本帖最后由 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
 楼主| 发表于 2010-9-19 16:04:53 | 显示全部楼层
回复 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
发表于 2010-9-19 16:50:31 | 显示全部楼层
本帖最后由 afan 于 2010-9-19 16:51 编辑
回复  afan


    OK了!受到你的启发
天堂泪吻泪 发表于 2010-9-19 16:04


为什么给你启发成这样了呢? 你这样不是从头到脚都没改变样式吗? 要GUISetStyle作甚…
 楼主| 发表于 2010-10-1 12:52:32 | 显示全部楼层
回复 6# afan


    本来,我是想做个文件拖动的,刚刚开始是可以,但当我想暂时置顶的时候,顶是置了,但是$WS_EX_ACCEPTFILES没了,$WS_EX_ACCEPTFILES有了,但不能置顶!!!很晕!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-9 11:45 , Processed in 0.090743 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表