Войти

Показать полную графическую версию : [решено] Маленькая проблема с эфектом закрывания дочернего окна


assch
19-07-2010, 02:33
Эфект открывания и закрывания основного окна работает нормально
А вот дочернее окно при закрывании если оно находится в зоне основного окна портит этот эфект
Я специально чуть развёл окна чтобы было видно что вне зоны окна оно закрывается с эфектом
а вот в зоне окна этот эфект плавного закрывания не работает
Можно это исправить или эта фишка с дочерним окном не пройдёт?
Можно конечно это сделать создав ещё один экзешник но просто хочется чтобы было всё в одном зкзешнике

#include <GUIConstants.au3>
Global $2
$1 = GUICreate("1" ,-1 ,-1 ,300 ,300)
$But = GUICtrlCreateButton("1", 50, 50, 80, 40 , $BS_FLAT)
DllCall("User32.dll","long","AnimateWindow","hwnd",$1,"long",500,"long",0x10)
GUISetState ()

While 1
$iMsg = GUIGetMsg(1)

Select

Case $iMsg[0] = $GUI_EVENT_CLOSE

If $iMsg[1] = $2 Then
DllCall("User32.dll","long","AnimateWindow","hwnd",$2,"long",500,"long",0x10+0x10000)

ElseIf $iMsg[1] = $1 Then
DllCall("User32.dll","long","AnimateWindow","hwnd",$1,"long",500,"long",0x10+0x10000)
Exit
EndIf

Case $iMsg[0] = $But
Function()

EndSelect

Wend

Func Function()
$2 = GUICreate("2", -1, -1, 500, 500, -1, -1, $1)
GUISetBkColor (0xffffff)
DllCall("User32.dll","long","AnimateWindow","hwnd",$2,"long",500,"long",0x10)
GUISetState()
EndFunc

Creat0R
19-07-2010, 02:57
Одно из решении это поставить временно прозрачность окна на 254 (не прозрачное окно это 255, т.ч это должно быть не значительно).

#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <GUIConstantsEx.au3>
#include (http://www.autoitscript.com/autoit3/docs/keywords.htm##include) <ButtonConstants.au3>

Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) $2

$1 = GUICreate (http://www.autoitscript.com/autoit3/docs/functions/GUICreate.htm)("1", -1, -1, 300, 300)
$But = GUICtrlCreateButton (http://www.autoitscript.com/autoit3/docs/functions/GUICtrlCreateButton.htm)("1", 50, 50, 80, 40, $BS_FLAT)
DllCall (http://www.autoitscript.com/autoit3/docs/functions/DllCall.htm)("User32.dll", "long", "AnimateWindow", "hwnd", $1, "long", 500, "long", 0x10)
GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)()

While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
$iMsg = GUIGetMsg (http://www.autoitscript.com/autoit3/docs/functions/GUIGetMsg.htm)(1)

Select (http://www.autoitscript.com/autoit3/docs/keywords.htm#Select)
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $iMsg[0] = $GUI_EVENT_CLOSE
If (http://www.autoitscript.com/autoit3/docs/keywords.htm#If) $iMsg[1] <> $1 Then (http://www.autoitscript.com/autoit3/docs/keywords.htm#Then)
WinSetTrans (http://www.autoitscript.com/autoit3/docs/functions/WinSetTrans.htm)($1, "", 254)
DllCall (http://www.autoitscript.com/autoit3/docs/functions/DllCall.htm)("User32.dll", "long", "AnimateWindow", "hwnd", $iMsg[1], "long", 500, "long", 0x10 + 0x10000)
WinSetTrans (http://www.autoitscript.com/autoit3/docs/functions/WinSetTrans.htm)($1, "", 255)
Else (http://www.autoitscript.com/autoit3/docs/keywords.htm#Else)
DllCall (http://www.autoitscript.com/autoit3/docs/functions/DllCall.htm)("User32.dll", "long", "AnimateWindow", "hwnd", $1, "long", 500, "long", 0x10 + 0x10000)
Exit (http://www.autoitscript.com/autoit3/docs/keywords.htm#Exit)
EndIf (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndIf)
Case (http://www.autoitscript.com/autoit3/docs/keywords.htm#Case) $iMsg[0] = $But
Function()
EndSelect (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndSelect)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)

Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) Function()
$2 = GUICreate (http://www.autoitscript.com/autoit3/docs/functions/GUICreate.htm)("2", -1, -1, 500, 500, -1, -1, $1)
GUISetBkColor (http://www.autoitscript.com/autoit3/docs/functions/GUISetBkColor.htm)(0xffffff)
DllCall (http://www.autoitscript.com/autoit3/docs/functions/DllCall.htm)("User32.dll", "long", "AnimateWindow", "hwnd", $2, "long", 500, "long", 0x10)
GUISetState (http://www.autoitscript.com/autoit3/docs/functions/GUISetState.htm)()
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc)

И кстати, судя по скрипту, у вас старая версия AutoIt, возможно не помешало бы обновиться ;)

assch
19-07-2010, 06:14
Большое спасибо Creat0R

Не всегда но иногда правда в поле зрения мелькает небольшая чёрная зона




© OSzone.net 2001-2012