powerofos Posted July 12, 2011 Posted July 12, 2011 (edited) Hi,Please help me with GUI style, look at the attached pictures(with comments), i am not good at expression.ThanksKim.Y Edited July 17, 2011 by powerofos
hannes08 Posted July 12, 2011 Posted July 12, 2011 Hi Kim, look at WinSetTrans() in the help file on how to create transparent windows. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
monoscout999 Posted July 12, 2011 Posted July 12, 2011 It looks like a nice proyect, the tabs also are BMPs and the slider have a cool skin... if i find something to that helps i will post here.
martin Posted July 12, 2011 Posted July 12, 2011 (edited) Hi Kim, look at WinSetTrans() in the help file on how to create transparent windows. I think it's a bit more difficult than that because from the screen shots there is what looks like a child window holding the images which is not made transparent. You can do that like this #include <windowsconstants.au3> $g = GUICreate("", 500, 500) GUISetState() $c = GUICreate("", 500, 300, 0, 200, $WS_POPUP, $WS_EX_MDICHILD, $g) $slide = GUICtrlCreateSlider(50, 100, 400, 42) GUISetState() GUISetBkColor(0xff0000, $c) WinSetTrans($g, "", 150) AdlibRegister("settrans", 100) $lastT = 0 While 1 $msg = GUIGetMsg() If $msg = -3 Then Exit WEnd Func settrans() Local $newT = GUICtrlRead($slide) * 2 + 54 If $newT <> $lastT Then WinSetTrans($g, "", $newT) $lastT = $newT EndIf EndFunc ;==>settrans though of course my example looks really bad, but the idea works. EDIT:changed +55 to +54 to stop annoying flash when maximum slider value, minimum transparency, reached. Edited July 13, 2011 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
powerofos Posted July 13, 2011 Author Posted July 13, 2011 I think it's a bit more difficult than that because from the screen shots there is what looks like a child window holding the images which is not made transparent. You can do that like this #include <windowsconstants.au3> $g = GUICreate("", 500, 500) GUISetState() $c = GUICreate("", 500, 300, 0, 200, $WS_POPUP, $WS_EX_MDICHILD, $g) $slide = GUICtrlCreateSlider(50, 100, 400, 42) GUISetState() GUISetBkColor(0xff0000, $c) WinSetTrans($g, "", 150) AdlibRegister("settrans", 100) $lastT = 0 While 1 $msg = GUIGetMsg() If $msg = -3 Then Exit WEnd Func settrans() Local $newT = GUICtrlRead($slide) * 2 + 54 If $newT <> $lastT Then WinSetTrans($g, "", $newT) $lastT = $newT EndIf EndFunc ;==>settrans though of course my example looks really bad, but the idea works. EDIT:changed +55 to +54 to stop annoying flash when maximum slider value, minimum transparency, reached. Hi Martin, I like your idea and i had tried it before, but i can't find a gui style which similary with the attached photo showed, perhaps GDI and API function are required. Kim.Y
powerofos Posted July 13, 2011 Author Posted July 13, 2011 It looks like a nice proyect, the tabs also are BMPs and the slider have a cool skin... if i find something to that helps i will post here.@monoscout999,The key point is the GUI style but not the silder, by the way, if you can build the slider like that, please notice me.Beautiful slider control! Kim.Y
taietel Posted July 13, 2011 Posted July 13, 2011 I've modified a little martin's code (here is a version without Adlib): expandcollapse popup#include <windowsconstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> $g = GUICreate("", 500, 500, -1, -1, BitOR($WS_SYSMENU, $WS_POPUP), $WS_EX_TOOLWINDOW) GUISetBkColor(0x111111) $hExit = GUICtrlCreateIcon("shell32.dll", -132, 478, 6, 16, 16, BitOR($SS_NOTIFY, $WS_GROUP, $WS_TABSTOP)) GUICtrlSetCursor(-1, 0) GUICtrlSetTip(-1, "Exit") _RoundCorners($g, 0.9) GUICtrlCreatePic("", 0, 0, 500,500, BitOR($GUI_SS_DEFAULT_PIC, $SS_CENTERIMAGE), $GUI_WS_EX_PARENTDRAG) GUISetState() $c = GUICreate("", 496, 300, 4, 198, $WS_POPUP, $WS_EX_MDICHILD, $g) $slide = GUICtrlCreateSlider(50, 100, 400, 42) GUICtrlSetLimit(-1, 254, 10) GUICtrlSetData($slide, 150) GUISetState() GUISetBkColor(0xff0000, $c) WinSetTrans($g, "", GUICtrlRead($slide)) While 1 Sleep(10) WinSetTrans($g, "", GUICtrlRead($slide)) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $hExit Exit EndSwitch WEnd Func _RoundCorners($hWnd, $iR = 1) Local $x, $pos $pos = WinGetPos($hWnd) If $pos[2] > $pos[3] Then $x = 10 * $pos[2] / $pos[3] Else $x = 10 * $pos[3] / $pos[2] EndIf Local $aResult = DllCall("gdi32.dll", "handle", "CreateRoundRectRgn", "int", 0, "int", 0, "int", $pos[2], "int", $pos[3], _ "int", $iR * $x, "int", $iR * $x) Local $aRet = DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hWnd, "handle", $aResult[0], "bool", True) If @error Then Return SetError(@error, @extended, False) Return $aRet[0] EndFunc ;==>_RoundCorners thanks for the idea, martin! Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text
powerofos Posted July 13, 2011 Author Posted July 13, 2011 (edited) I've modified a little martin's code (here is a version without Adlib): expandcollapse popup#include <windowsconstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> $g = GUICreate("", 500, 500, -1, -1, BitOR($WS_SYSMENU, $WS_POPUP), $WS_EX_TOOLWINDOW) GUISetBkColor(0x111111) $hExit = GUICtrlCreateIcon("shell32.dll", -132, 478, 6, 16, 16, BitOR($SS_NOTIFY, $WS_GROUP, $WS_TABSTOP)) GUICtrlSetCursor(-1, 0) GUICtrlSetTip(-1, "Exit") _RoundCorners($g, 0.9) GUICtrlCreatePic("", 0, 0, 500,500, BitOR($GUI_SS_DEFAULT_PIC, $SS_CENTERIMAGE), $GUI_WS_EX_PARENTDRAG) GUISetState() $c = GUICreate("", 496, 300, 4, 198, $WS_POPUP, $WS_EX_MDICHILD, $g) $slide = GUICtrlCreateSlider(50, 100, 400, 42) GUICtrlSetLimit(-1, 254, 10) GUICtrlSetData($slide, 150) GUISetState() GUISetBkColor(0xff0000, $c) WinSetTrans($g, "", GUICtrlRead($slide)) While 1 Sleep(10) WinSetTrans($g, "", GUICtrlRead($slide)) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $hExit Exit EndSwitch WEnd Func _RoundCorners($hWnd, $iR = 1) Local $x, $pos $pos = WinGetPos($hWnd) If $pos[2] > $pos[3] Then $x = 10 * $pos[2] / $pos[3] Else $x = 10 * $pos[3] / $pos[2] EndIf Local $aResult = DllCall("gdi32.dll", "handle", "CreateRoundRectRgn", "int", 0, "int", 0, "int", $pos[2], "int", $pos[3], _ "int", $iR * $x, "int", $iR * $x) Local $aRet = DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hWnd, "handle", $aResult[0], "bool", True) If @error Then Return SetError(@error, @extended, False) Return $aRet[0] EndFunc ;==>_RoundCorners thanks for the idea, martin! @taietel, Thanks for your modified version. A new attached photo, maybe GDI and API function are required. Regards Kim.Y Edited July 13, 2011 by powerofos
taietel Posted July 13, 2011 Posted July 13, 2011 powerofos, that can be done easily . Search for GDIP UDF of Authenticity, WinAPIEx UDF of Yashied, examples of UEZ (master of the GDI) etc. This will be a really nice project! Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text
martin Posted July 13, 2011 Posted July 13, 2011 (edited) powerofos, that can be done easily . Search for GDIP UDF of Authenticity, WinAPIEx UDF of Yashied, examples of UEZ (master of the GDI) etc. This will be a really nice project! Here's how you can shape the non-transparent bit an dhave a slider bar a bit like the one show in post 1. (Using taietel's example) expandcollapse popup#include <windowsconstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <GDIPlus.au3> Const $STM_SETIMAGE = 0x0172 Const $IMAGE_BITMAP = 0 $g = GUICreate("", 500, 500, -1, -1, BitOR($WS_SYSMENU, $WS_POPUP), $WS_EX_TOOLWINDOW) GUISetBkColor(0x111111) $hExit = GUICtrlCreateIcon("shell32.dll", -132, 478, 6, 16, 16, BitOR($SS_NOTIFY, $WS_GROUP, $WS_TABSTOP)) GUICtrlSetCursor(-1, 0) GUICtrlSetTip(-1, "Exit") _RoundCorners($g, 0.9) GUICtrlCreatePic("", 0, 0, 500, 500, BitOR($GUI_SS_DEFAULT_PIC, $SS_CENTERIMAGE), $GUI_WS_EX_PARENTDRAG) GUISetState() $c = GUICreate("", 496, 300, 4, 198, $WS_POPUP, $WS_EX_MDICHILD, $g) $Pic = GUICtrlCreatePic("", 50, 100, 400, 12) GUICtrlSetState(-1, $GUI_DISABLE) #region make slider $hPic = GUICtrlGetHandle($Pic) _GDIPlus_Startup() $wGraph = _GDIPlus_GraphicsCreateFromHWND($c) ;_GDIPlus_GraphicsDispose($SheetWindowGraph) $MainImage = _GDIPlus_BitmapCreateFromGraphics(400, 12, $wGraph) ;_GDIPlus_BitmapDispose($MainImage) $MainGraphic = _GDIPlus_ImageGetGraphicsContext($MainImage) _GDIPlus_GraphicsClear($MainGraphic, 0xFFF00FFF) ;_GDIPlus_GraphicsSetSmoothingMode($MainGraphic, 0); 2) For $n = 0 To 400 $hPen = _GDIPlus_PenCreate(0xff0000FF + Int($n * 255 / 400) * 2 ^ 8 + Int($n * 255 / 400) * 2 ^ 16, 1);+ $n*2^16/400 + $n*255/400;// Bitshift(Int($n*255/400),1) + _GDIPlus_GraphicsDrawLine($MainGraphic, $n, 0, $n, 12, $hPen) _GDIPlus_PenDispose($hPen) Next $hbmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($MainImage) $aBmp = DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hPic, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hbmp) If $aBmp[0] <> 0 Then _WinAPI_DeleteObject($aBmp[0]) _WinAPI_DeleteObject($hbmp) _GDIPlus_Shutdown() $B = GUICtrlCreateButton("", 50, 95, 30, 22) #endregion make slider $chk1 = GUICtrlCreateCheckbox("fade background", 100, 140) $chk2 = GUICtrlCreateCheckbox("fade foreground", 100, 170) #region make shaped cutout $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 496, "long", 300) $rct = DllStructCreate("int;int;int;inr", $aM_Mask[0]) $Dia = 200 For $j = 0 To $Dia / 3;the arch height $startx = 0 $starty = $j $endx = Round(0.4 + $Dia / 2 - Sqrt($Dia * $Dia / 4 - ($Dia / 2 - $j) ^ 2), 0) $endy = $starty addRegion( $aM_Mask, $startx, $starty, $endx, $endy + 1) $startx = $Dia - $endx $endx = $Dia + 1 addRegion( $aM_Mask, $startx, $starty, $endx, $endy + 1) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $c, "long", $aM_Mask[0], "int", 1) #endregion make shaped cutout GUISetState() GUISetBkColor(0xff0000, $c) $lastpos = 0 $newpos = 0 While 1 Sleep(10) $ci = GUIGetCursorInfo($c) ConsoleWrite($ci[4] & @CRLF) If $ci[2] And $ci[4] = $B Then $startx = $ci[0] $startb = ControlGetPos($c, "", $B) While $ci[2] $ci = GUIGetCursorInfo($c) $newpos = $startb[0] + $ci[0] - $startx If $newpos < 60 Then $newpos = 50 If $newpos > 420 Then $newpos = 420 If $newpos <> $lastpos Then ControlMove($c, "", $B, $newpos, 95) If GUICtrlRead($chk1) = $GUI_CHECKED Then WinSetTrans($g, "", 255 - ($newpos - 50) * 254 / 400) If GUICtrlRead($chk2) = $GUI_CHECKED Then WinSetTrans($c, "", 255 - ($newpos - 50) * 254 / 400) $lastpos = $newpos EndIf WEnd EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $hExit Exit EndSwitch WEnd Func addRegion($MMask, $sx, $sy, $ex, $ey) Local $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $sx, "long", $sy, "long", $ex, "long", $ey) DllCall("gdi32.dll", "long", "CombineRgn", "long", $MMask[0], "long", $aMask[0], "long", $MMask[0], "int", 3) EndFunc ;==>addRegion Func _RoundCorners($hWnd, $iR = 1) Local $x, $pos $pos = WinGetPos($hWnd) If $pos[2] > $pos[3] Then $x = 10 * $pos[2] / $pos[3] Else $x = 10 * $pos[3] / $pos[2] EndIf Local $aResult = DllCall("gdi32.dll", "handle", "CreateRoundRectRgn", "int", 0, "int", 0, "int", $pos[2], "int", $pos[3], _ "int", $iR * $x, "int", $iR * $x) Local $aRet = DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hWnd, "handle", $aResult[0], "bool", True) If @error Then Return SetError(@error, @extended, False) Return $aRet[0] EndFunc ;==>_RoundCorners EDIT: Tidied code a bit, added option to fade sections. Edited July 13, 2011 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
monoscout999 Posted July 13, 2011 Posted July 13, 2011 matbe some DWM functions, the pic seem to have the blur effect from aero but i can´t find the way to put the pic in the windows.. there an example of the function DwmExtendFrameIntoClientArea in the winapiex UDF We only need to find a way to put a pic inside, and do the trasparent effect, and find out how to put the icons in the tabs.. expandcollapse popup#Include <Constants.au3> #Include <GUITab.au3> #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) Opt('TrayAutoPause', 0) If Not _WinAPI_DwmIsCompositionEnabled() Then MsgBox(16, 'Error', 'Require Windows Vista or later with enabled Aero theme.') Exit EndIf Global Const $PRF_CLIENT = 0x04 Global $hForm, $hTab, $tMARGINS, $hDll, $pDll, $hProc OnAutoItExitRegister('OnAutoItExit') ; Create GUI $hForm = GUICreate('MyGUI', 400, 400) GUICtrlCreateTab(0, 60, 402, 341, $WS_CLIPCHILDREN) $hTab = GUICtrlGetHandle(-1) GUICtrlCreateTabItem('Tab 1') GUICtrlCreateButton('Button', 150, 167, 100, 26) _WinAPI_SetParent(GUICtrlGetHandle(-1), $hTab) GUICtrlCreateTabItem('Tab 2') GUICtrlCreateEdit('', 14, 34, 372, 292) _WinAPI_SetParent(GUICtrlGetHandle(-1), $hTab) GUICtrlCreateTabItem('Tab 3') GUICtrlCreateTabItem('') GUISetBkColor(0) ; Register Tab window proc $hDll = DllCallbackRegister('_WinProc', 'ptr', 'hwnd;uint;wparam;lparam') $pDll = DllCallbackGetPtr($hDll) $hProc = _WinAPI_SetWindowLongEx($hTab, $GWL_WNDPROC, $pDll) ; Create the "sheet of glass" effect for the Tab client area. You must call this function whenever DWM composition is toggled. $tMARGINS = DllStructCreate($tagMARGINS) DllStructSetData($tMARGINS, 1, 2) DllStructSetData($tMARGINS, 2, 2) DllStructSetData($tMARGINS, 3, 82) DllStructSetData($tMARGINS, 4, 2) _WinAPI_DwmExtendFrameIntoClientArea($hForm, $tMARGINS) GUISetState() Do Until GUIGetMsg() = -3 Func _CreateClipRgn($hWnd) Local $tRECT, $hTmp, $hRgn, $Ht, $Count, $Sel $Count = _GUICtrlTab_GetItemCount($hWnd) $Sel = _GUICtrlTab_GetCurSel($hWnd) $hRgn = _WinAPI_CreateNullRgn() For $i = 0 To $Count - 1 $tRECT = _GUICtrlTab_GetItemRectEx($hWnd, $i) If $i = $Sel Then $hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1) - 2, DllStructGetData($tRECT, 2) - 2, DllStructGetData($tRECT, 3) + 2, DllStructGetData($tRECT, 4)) $Ht = DllStructGetData($tRECT, 4) - DllStructGetData($tRECT, 2) + 2 Else If $i = $Count - 1 Then $hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1), DllStructGetData($tRECT, 2), DllStructGetData($tRECT, 3) - 2, DllStructGetData($tRECT, 4)) Else $hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1), DllStructGetData($tRECT, 2), DllStructGetData($tRECT, 3), DllStructGetData($tRECT, 4)) EndIf EndIf _WinAPI_CombineRgn($hRgn, $hRgn, $hTmp, $RGN_OR) _WinAPI_DeleteObject($hTmp) Next $tRECT = _WinAPI_GetClientRect($hWnd) $hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1), DllStructGetData($tRECT, 2) + $Ht, DllStructGetData($tRECT, 3) - 2, DllStructGetData($tRECT, 4) - 1) _WinAPI_CombineRgn($hRgn, $hRgn, $hTmp, $RGN_OR) _WinAPI_DeleteObject($hTmp) Return $hRgn EndFunc ;==>_CreateClipRgn Func _WinProc($hWnd, $iMsg, $wParam, $lParam) If _WinAPI_IsThemeActive() Then Switch $iMsg Case $WM_ERASEBKGND Local $tRECT, $hBrush, $hRgn, $hPrev $hPrev = _WinAPI_GetClipRgn($wParam) $hRgn = _CreateClipRgn($hWnd) _WinAPI_ExtSelectClipRgn($wParam, $hRgn, $RGN_DIFF) $tRECT = _WinAPI_GetClientRect($hWnd) $hBrush = _WinAPI_CreateSolidBrush(0) _WinAPI_FillRect($wParam, DllStructGetPtr($tRECT), $hBrush) _WinAPI_SelectClipRgn($wParam, $hPrev) _WinAPI_DeleteObject($hBrush) _WinAPI_DeleteObject($hRgn) Return 1 Case $WM_PAINT Local $tPAINTSTRUCT, $hDC, $hRgn $hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT) $hRgn = _CreateClipRgn($hWnd) _WinAPI_ExtSelectClipRgn($hDC, $hRgn, $RGN_AND) _WinAPI_CallWindowProc($hProc, $hWnd, $WM_PRINTCLIENT, $hDC, $PRF_CLIENT) _WinAPI_DeleteObject($hRgn) _WinAPI_EndPaint($hWnd, $tPAINTSTRUCT) Return 0 EndSwitch EndIf Return _WinAPI_CallWindowProc($hProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_WinProc Func OnAutoItExit() _WinAPI_SetWindowLongEx($hTab, $GWL_WNDPROC, $hProc) DllCallbackFree($hDll) EndFunc ;==>OnAutoItExit
taietel Posted July 13, 2011 Posted July 13, 2011 tip also did a fine job Things you should know first...In the beginning there was only ONE! And zero... Progs: Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text
monoscout999 Posted July 13, 2011 Posted July 13, 2011 Another version with slide expandcollapse popup#Include <Constants.au3> #Include <GUITab.au3> #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) Opt('TrayAutoPause', 0) If Not _WinAPI_DwmIsCompositionEnabled() Then MsgBox(16, 'Error', 'Require Windows Vista or later with enabled Aero theme.') Exit EndIf Global Const $PRF_CLIENT = 0x04 Global $hForm, $hTab, $tMARGINS, $hDll, $pDll, $hProc, $slider, $hSlider OnAutoItExitRegister('OnAutoItExit') ; Create GUI $hForm = GUICreate('MyGUI', 400, 400) GUICtrlCreateTab(0, 60, 402, 341, $WS_CLIPCHILDREN) $hTab = GUICtrlGetHandle(-1) GUICtrlCreateTabItem('Tab 1') GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") $slider = GUICtrlCreateslider(10, 167, 380, 26) Guictrlsetlimit(-1,255,0) $hSlider = GUICtrlGetHandle(-1) _WinAPI_SetParent(GUICtrlGetHandle(-1), $hTab) GUICtrlCreateTabItem('Tab 2') GUICtrlCreateEdit('', 14, 34, 372, 292) _WinAPI_SetParent(GUICtrlGetHandle(-1), $hTab) GUICtrlCreateTabItem('Tab 3') GUICtrlCreateTabItem('') GUISetBkColor(0) ; Register Tab window proc $hDll = DllCallbackRegister('_WinProc', 'ptr', 'hwnd;uint;wparam;lparam') $pDll = DllCallbackGetPtr($hDll) $hProc = _WinAPI_SetWindowLongEx($hTab, $GWL_WNDPROC, $pDll) ; Create the "sheet of glass" effect for the Tab client area. You must call this function whenever DWM composition is toggled. $tMARGINS = DllStructCreate($tagMARGINS) DllStructSetData($tMARGINS, 1, 2) DllStructSetData($tMARGINS, 2, 2) DllStructSetData($tMARGINS, 3, 82) DllStructSetData($tMARGINS, 4, 2) _WinAPI_DwmExtendFrameIntoClientArea($hForm, $tMARGINS) GUISetState() Do Until GUIGetMsg() = -3 Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndSlider $hWndSlider = $hSlider If Not IsHWnd($hSlider) Then $hWndSlider = GUICtrlGetHandle($hSlider) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndSlider winsettrans($hWnd,"", (Guictrlread($Slider)-255)*-1) EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_NOTIFY Func _CreateClipRgn($hWnd) Local $tRECT, $hTmp, $hRgn, $Ht, $Count, $Sel $Count = _GUICtrlTab_GetItemCount($hWnd) $Sel = _GUICtrlTab_GetCurSel($hWnd) $hRgn = _WinAPI_CreateNullRgn() For $i = 0 To $Count - 1 $tRECT = _GUICtrlTab_GetItemRectEx($hWnd, $i) If $i = $Sel Then $hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1) - 2, DllStructGetData($tRECT, 2) - 2, DllStructGetData($tRECT, 3) + 2, DllStructGetData($tRECT, 4)) $Ht = DllStructGetData($tRECT, 4) - DllStructGetData($tRECT, 2) + 2 Else If $i = $Count - 1 Then $hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1), DllStructGetData($tRECT, 2), DllStructGetData($tRECT, 3) - 2, DllStructGetData($tRECT, 4)) Else $hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1), DllStructGetData($tRECT, 2), DllStructGetData($tRECT, 3), DllStructGetData($tRECT, 4)) EndIf EndIf _WinAPI_CombineRgn($hRgn, $hRgn, $hTmp, $RGN_OR) _WinAPI_DeleteObject($hTmp) Next $tRECT = _WinAPI_GetClientRect($hWnd) $hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1), DllStructGetData($tRECT, 2) + $Ht, DllStructGetData($tRECT, 3) - 2, DllStructGetData($tRECT, 4) - 1) _WinAPI_CombineRgn($hRgn, $hRgn, $hTmp, $RGN_OR) _WinAPI_DeleteObject($hTmp) Return $hRgn EndFunc ;==>_CreateClipRgn Func _WinProc($hWnd, $iMsg, $wParam, $lParam) If _WinAPI_IsThemeActive() Then Switch $iMsg Case $WM_ERASEBKGND Local $tRECT, $hBrush, $hRgn, $hPrev $hPrev = _WinAPI_GetClipRgn($wParam) $hRgn = _CreateClipRgn($hWnd) _WinAPI_ExtSelectClipRgn($wParam, $hRgn, $RGN_DIFF) $tRECT = _WinAPI_GetClientRect($hWnd) $hBrush = _WinAPI_CreateSolidBrush(0) _WinAPI_FillRect($wParam, DllStructGetPtr($tRECT), $hBrush) _WinAPI_SelectClipRgn($wParam, $hPrev) _WinAPI_DeleteObject($hBrush) _WinAPI_DeleteObject($hRgn) Return 1 Case $WM_PAINT Local $tPAINTSTRUCT, $hDC, $hRgn $hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT) $hRgn = _CreateClipRgn($hWnd) _WinAPI_ExtSelectClipRgn($hDC, $hRgn, $RGN_AND) _WinAPI_CallWindowProc($hProc, $hWnd, $WM_PRINTCLIENT, $hDC, $PRF_CLIENT) _WinAPI_DeleteObject($hRgn) _WinAPI_EndPaint($hWnd, $tPAINTSTRUCT) Return 0 EndSwitch EndIf Return _WinAPI_CallWindowProc($hProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_WinProc Func OnAutoItExit() _WinAPI_SetWindowLongEx($hTab, $GWL_WNDPROC, $hProc) DllCallbackFree($hDll) EndFunc ;==>OnAutoItExit
powerofos Posted July 14, 2011 Author Posted July 14, 2011 matbe some DWM functions, the pic seem to have the blur effect from aero but i can´t find the way to put the pic in the windows.. there an example of the function DwmExtendFrameIntoClientArea in the winapiex UDF We only need to find a way to put a pic inside, and do the trasparent effect, and find out how to put the icons in the tabs.. expandcollapse popup#Include <Constants.au3> #Include <GUITab.au3> #Include <WinAPIEx.au3> Opt('MustDeclareVars', 1) Opt('TrayAutoPause', 0) If Not _WinAPI_DwmIsCompositionEnabled() Then MsgBox(16, 'Error', 'Require Windows Vista or later with enabled Aero theme.') Exit EndIf Global Const $PRF_CLIENT = 0x04 Global $hForm, $hTab, $tMARGINS, $hDll, $pDll, $hProc OnAutoItExitRegister('OnAutoItExit') ; Create GUI $hForm = GUICreate('MyGUI', 400, 400) GUICtrlCreateTab(0, 60, 402, 341, $WS_CLIPCHILDREN) $hTab = GUICtrlGetHandle(-1) GUICtrlCreateTabItem('Tab 1') GUICtrlCreateButton('Button', 150, 167, 100, 26) _WinAPI_SetParent(GUICtrlGetHandle(-1), $hTab) GUICtrlCreateTabItem('Tab 2') GUICtrlCreateEdit('', 14, 34, 372, 292) _WinAPI_SetParent(GUICtrlGetHandle(-1), $hTab) GUICtrlCreateTabItem('Tab 3') GUICtrlCreateTabItem('') GUISetBkColor(0) ; Register Tab window proc $hDll = DllCallbackRegister('_WinProc', 'ptr', 'hwnd;uint;wparam;lparam') $pDll = DllCallbackGetPtr($hDll) $hProc = _WinAPI_SetWindowLongEx($hTab, $GWL_WNDPROC, $pDll) ; Create the "sheet of glass" effect for the Tab client area. You must call this function whenever DWM composition is toggled. $tMARGINS = DllStructCreate($tagMARGINS) DllStructSetData($tMARGINS, 1, 2) DllStructSetData($tMARGINS, 2, 2) DllStructSetData($tMARGINS, 3, 82) DllStructSetData($tMARGINS, 4, 2) _WinAPI_DwmExtendFrameIntoClientArea($hForm, $tMARGINS) GUISetState() Do Until GUIGetMsg() = -3 Func _CreateClipRgn($hWnd) Local $tRECT, $hTmp, $hRgn, $Ht, $Count, $Sel $Count = _GUICtrlTab_GetItemCount($hWnd) $Sel = _GUICtrlTab_GetCurSel($hWnd) $hRgn = _WinAPI_CreateNullRgn() For $i = 0 To $Count - 1 $tRECT = _GUICtrlTab_GetItemRectEx($hWnd, $i) If $i = $Sel Then $hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1) - 2, DllStructGetData($tRECT, 2) - 2, DllStructGetData($tRECT, 3) + 2, DllStructGetData($tRECT, 4)) $Ht = DllStructGetData($tRECT, 4) - DllStructGetData($tRECT, 2) + 2 Else If $i = $Count - 1 Then $hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1), DllStructGetData($tRECT, 2), DllStructGetData($tRECT, 3) - 2, DllStructGetData($tRECT, 4)) Else $hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1), DllStructGetData($tRECT, 2), DllStructGetData($tRECT, 3), DllStructGetData($tRECT, 4)) EndIf EndIf _WinAPI_CombineRgn($hRgn, $hRgn, $hTmp, $RGN_OR) _WinAPI_DeleteObject($hTmp) Next $tRECT = _WinAPI_GetClientRect($hWnd) $hTmp = _WinAPI_CreateRectRgn(DllStructGetData($tRECT, 1), DllStructGetData($tRECT, 2) + $Ht, DllStructGetData($tRECT, 3) - 2, DllStructGetData($tRECT, 4) - 1) _WinAPI_CombineRgn($hRgn, $hRgn, $hTmp, $RGN_OR) _WinAPI_DeleteObject($hTmp) Return $hRgn EndFunc ;==>_CreateClipRgn Func _WinProc($hWnd, $iMsg, $wParam, $lParam) If _WinAPI_IsThemeActive() Then Switch $iMsg Case $WM_ERASEBKGND Local $tRECT, $hBrush, $hRgn, $hPrev $hPrev = _WinAPI_GetClipRgn($wParam) $hRgn = _CreateClipRgn($hWnd) _WinAPI_ExtSelectClipRgn($wParam, $hRgn, $RGN_DIFF) $tRECT = _WinAPI_GetClientRect($hWnd) $hBrush = _WinAPI_CreateSolidBrush(0) _WinAPI_FillRect($wParam, DllStructGetPtr($tRECT), $hBrush) _WinAPI_SelectClipRgn($wParam, $hPrev) _WinAPI_DeleteObject($hBrush) _WinAPI_DeleteObject($hRgn) Return 1 Case $WM_PAINT Local $tPAINTSTRUCT, $hDC, $hRgn $hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT) $hRgn = _CreateClipRgn($hWnd) _WinAPI_ExtSelectClipRgn($hDC, $hRgn, $RGN_AND) _WinAPI_CallWindowProc($hProc, $hWnd, $WM_PRINTCLIENT, $hDC, $PRF_CLIENT) _WinAPI_DeleteObject($hRgn) _WinAPI_EndPaint($hWnd, $tPAINTSTRUCT) Return 0 EndSwitch EndIf Return _WinAPI_CallWindowProc($hProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_WinProc Func OnAutoItExit() _WinAPI_SetWindowLongEx($hTab, $GWL_WNDPROC, $hProc) DllCallbackFree($hDll) EndFunc ;==>OnAutoItExit @monoscout999, "bingo" I agree, that's what i done in my initial script, but i found i can't put the picture as the GUI background. So i tried another GUI style, $popup. What $popup brings to me? No shadow, no round corner, no frame, i just can't build a GUI look like the attached photo. Kim.Y
powerofos Posted July 14, 2011 Author Posted July 14, 2011 (edited) Thanks, Martin Nice slider emample for me. Kim.Y Edited July 14, 2011 by powerofos
powerofos Posted July 14, 2011 Author Posted July 14, 2011 tip also did a fine job Thanks taietel,Yeah, i learnt something from tip's example, thanks tip Kim.Y
monoscout999 Posted July 14, 2011 Posted July 14, 2011 This is way too hard... i got thisI use a tool called Restoration 2007 ( too hard to find ) Is like the resource hack, but with this i can open the aero.msstyles file and look for the PNGs files used by AERO theme. i need to modify many permission of windows before attempt to change anything of this file. and i don´t know if this file is exchangeable or not if you want to try here you got my hack file ( do a backup of yours before replace it with this and rename this file also ) Link to aero.msstyles file Also i left here a guide for customize win7 Guide, there also have the link for the program Restoration 2007 and a fully guide of how to change and customize your win7...I think there must be an easiest and better way to do this.
powerofos Posted July 14, 2011 Author Posted July 14, 2011 This is way too hard... i got thisI use a tool called Restoration 2007 ( too hard to find ) Is like the resource hack, but with this i can open the aero.msstyles file and look for the PNGs files used by AERO theme. i need to modify many permission of windows before attempt to change anything of this file. and i don´t know if this file is exchangeable or not if you want to try here you got my hack file ( do a backup of yours before replace it with this and rename this file also ) Link to aero.msstyles file Also i left here a guide for customize win7 Guide, there also have the link for the program Restoration 2007 and a fully guide of how to change and customize your win7...I think there must be an easiest and better way to do this.Wow, good idea! I will try it on. I think i need more time to figure it out, thanks a lot.Kim.Y
monoscout999 Posted July 14, 2011 Posted July 14, 2011 Wow, good idea! I will try it on. I think i need more time to figure it out, thanks a lot.Kim.YAs i already says... is too hard!! i`m still looking for a simple way to do it.
powerofos Posted July 17, 2011 Author Posted July 17, 2011 (edited) After a few day's working, i got a idea to approach my target, i wish some one can give me a help so that i could make the script more consummate. Please look at my sample script. So far i still have a few questions to go on thinking: 1, Automate round corner fitting the Main GUI.(second GUI, third GUI and Main GUI, looks like "all in one") 2, Size of the original background picture is smaller then my major GUI. 3, Take a useful region from a picture if the target picture is too bigger to my main GUI. expandcollapse popup;Code by Powerofos #Include <GDIPlus.au3> #Include <File.au3> #Include <Misc.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #Include <WinAPIEx.au3> #Include <Constants.au3> #Include <GUIConstantsEx.au3> #Include <FontConstants.au3> #Include <WindowsConstants.au3> #include <StaticConstants.au3> ;~ #include "X_Init.au3" ;My private UDF.au3 OnAutoItExitRegister('OnAutoItExit') _GDIPlus_Startup() ;==================================================================================================== ;Init` data Global $DefPicGUI_Trans = 55 Global $DefCtrlGUI_Trans = 55 Global $Width = 950 ;Size of major GUI Global $Height = 600 Global $TipsOnOff = 0 Global $DefMaskColor = 0xABABAB Global $DefChooseADD = "" Global $CurBKOriSize[2] Global Const $AC_SRC_ALPHA = 1 Global $Background_Pic = @ScriptDir&"\BK.jpg" ;picture path ;~ Global $Background_Pic = @ScriptDir&"\BK2.png" ;picture path Global $MainGUI = GUICreate("MainGUI",$Width,$Height,-1,-1,BitOR($WS_POPUP,$WS_CAPTION)) GUISetBkColor(0x000000,$MainGUI) $DwnLabel = GUICtrlGetHandle(GUICtrlCreateLabel("",0,0,$Width,$Height)) GUICtrlSetState(-1,$GUI_DISABLE) Global $RegDllCall,$RegDllGetPtr,$RegDllProc $RegDllCall = DllCallbackRegister("_WinProc","ptr","hwnd;uint;wparam;lparam") $RegDllGetPtr = DllCallbackGetPtr($RegDllCall) $RegDllProc = _WinAPI_SetWindowLong($DwnLabel,$GWL_WNDPROC,$RegDllGetPtr) ;~ Global $CtrlTest = GUICtrlCreateButton("MainGUI_CtrlTest",24,10,120,48) ;For Z order test _WinAPI_DwmExtendFrameIntoClientArea($MainGUI) Global $fSize_X = _WinAPI_GetSystemMetrics($SM_CXFRAME) Global $fSize_Y = _WinAPI_GetSystemMetrics($SM_CYCAPTION) Global $fSize_OffSet = 1 If $fSize_OffSet <> "" Then $fSize_X = $fSize_X-$fSize_OffSet $fSize_Y = $fSize_Y+$fSize_X EndIf ;==================================================================================================== Global $Width2 = $Width+$fSize_X*2 Global $Height2 = $Height-20 $PicGUI = GUICreate("PicGUI",$Width2,$Height2,-$fSize_X,0,$WS_POPUP,BitOR($WS_EX_LAYERED,$WS_EX_MDICHILD),$MainGUI) ;~ $PicGUI = GUICreate("PicGUI",$Width,$Height,-$fSize_X,-$fSize_Y,$WS_POPUP,BitOR($WS_EX_LAYERED,$WS_EX_MDICHILD),$MainGUI) _GDIPlus_DrawImageAsBackground($PicGUI,$Width2,$Height2,$Background_Pic,$DefPicGUI_Trans) ;~ Global $fSize_X2 = _WinAPI_GetSystemMetrics($SM_CXFRAME) ;~ Global $fSize_Y2 = _WinAPI_GetSystemMetrics($SM_CYCAPTION) ;~ Global $fSize_OffSet2 = 1 Global $fSize_X2 = 3 Global $fSize_Y2 = 3 ;==================================================================================================== $CtrlGUI = GUICreate("",$Width2,$Height2,$fSize_X2,$fSize_Y2,$WS_POPUP,BitOR($WS_EX_LAYERED,$WS_EX_MDICHILD),$PicGUI) GUISetBkColor($DefMaskColor,$CtrlGUI) _WinAPI_SetLayeredWindowAttributes($CtrlGUI,0x010101) $Slider3 = GUICtrlCreateSlider(80,140,450,35, $WS_BORDER) GUICtrlSetData(-1,100) GUICtrlCreateLabel("Seperate",24,200,570,20,$SS_ETCHEDHORZ) GUIStartGroup() $Radio1 = GUICtrlCreateRadio("Use Mask Color", 80,235,110,20) GUICtrlSetState(-1,$gui_checked) GUICtrlSetBkColor(-1,0xff0000) ;make me click the radio more easier in case of transparent GUI background $Radio2 = GUICtrlCreateRadio("BK color Transparent ",80,280,150,20) GUICtrlSetBkColor(-1,0xff0000) GUIStartGroup() $MaskBTN = GUICtrlCreateButton("Choose Mask Color",210,225,180,40) $Slider2 = GUICtrlCreateSlider(250,275,280,35, $WS_BORDER) GUICtrlSetData(-1,($DefCtrlGUI_Trans-55)/2) _WinAPI_SetLayeredWindowAttributes($CtrlGUI, 0x010101, $DefCtrlGUI_Trans) ;Set Control GUI GUICtrlCreateLabel("Seperate",24,333,570,20,$SS_ETCHEDHORZ) $Slider = GUICtrlCreateSlider(80,360,450,35, $WS_BORDER) GUICtrlSetData(-1,$DefPicGUI_Trans/255*100) Global $SkinBTN = GUICtrlCreateButton("Other Bitmap",80,420,220,40) Global $SwitchPNGBTN = GUICtrlCreateButton("Switch to PNG BK",310,420,220,40) ;==================================================================================================== ;~ _GuiHole($PicGUI, $Width+14, 0, 300, $pic_H, $pic_w,$pic_H) ;cut the part of picture which over of main gui GUISetState(@SW_SHOW,$CtrlGUI) GUISetState(@SW_SHOW,$PicGUI) GUISetState(@SW_SHOW,$MainGUI) HotKeySet("{F2}","RoundCorner") AdlibRegister("TipsProc",6000) While 1 $nMsg = GUIGetMsg() Switch $nMsg ;~ Case $CtrlTest ;~ MsgBox(0,"","MainGUI_BTN") Case $SkinBTN SkinLoader() Case $SwitchPNGBTN If FileExists(@ScriptDir&"\BK2.png") Then $Background_Pic = @ScriptDir&"\BK2.png" _GDIPlus_DrawImageAsBackground($PicGUI,$Width2,$Height2,$Background_Pic,$DefPicGUI_Trans) Else MsgBox(0,"Error","No exist file: "&@ScriptDir&"\BK2.png") EndIf Case $Slider3 Local $trans = Round(GUICtrlRead($Slider3)*2 + 55) WinSetTrans("MainGUI","",$trans) $TipsOnOff = 1 ToolTip("Set MainGUI Trans:"&$trans) AdlibRegister("TipsProc",6000) Case $Slider2 If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED Then Local $trans = Round(GUICtrlRead($Slider2)*2 + 55) _WinAPI_SetLayeredWindowAttributes($CtrlGUI, 0x010101, $trans) $DefCtrlGUI_Trans = $trans $TipsOnOff = 1 ToolTip("Use Mask Color:"&$DefMaskColor&" | Trans:"&$trans) AdlibRegister("TipsProc",6000) Else Local $trans = Round(GUICtrlRead($Slider2)*2 + 55) _WinAPI_SetLayeredWindowAttributes($CtrlGUI, $DefMaskColor, $trans) $DefCtrlGUI_Trans = $trans $TipsOnOff = 1 ToolTip("BK color Transparent:Trans:"&$trans) AdlibRegister("TipsProc",6000) EndIf Case $Slider Local $trans = Round(GUICtrlRead($Slider)/100*255) _GDIPlus_DrawImageAsBackground($PicGUI,$Width2,$Height2,$Background_Pic,$trans) $DefPicGUI_Trans = $trans $TipsOnOff = 1 ToolTip("Middle Layer GUI - Pic GUI Trans Set:"&$trans) AdlibRegister("TipsProc",6000) Case $Radio1 If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED Then _WinAPI_SetLayeredWindowAttributes($CtrlGUI, 0x010101, $DefCtrlGUI_Trans) EndIf Case $Radio2 If BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) = $GUI_CHECKED Then _WinAPI_SetLayeredWindowAttributes($CtrlGUI, $DefMaskColor, $DefCtrlGUI_Trans) EndIf Case $MaskBTN If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED Then Local $NewColor = _ChooseColor(2,$DefMaskColor,2);,$CtrlGUI) If $NewColor = -1 Then ContinueLoop $DefMaskColor = $NewColor GUISetBkColor($DefMaskColor, $CtrlGUI) _WinAPI_SetLayeredWindowAttributes($CtrlGUI, 0x010101, $DefCtrlGUI_Trans) Else $TipsOnOff = 1 ToolTip("Please switch mode by click the left side first radio") AdlibRegister("TipsProc",6000) EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func SkinLoader() Local $FileOpen = FileOpenDialog("Bitmap selector",$DefChooseADD,"Bitmap(*.jpg;*.bmp;*png)",1) If @error Then Return $Background_Pic = $FileOpen _GDIPlus_DrawImageAsBackground($PicGUI,$Width2,$Height2,$Background_Pic,$DefPicGUI_Trans) Local $szDrive,$szDir,$szFName,$szExt _PathSplit(@ScriptFullPath,$szDrive,$szDir,$szFName,$szExt) $DefChooseADD = $szDrive&$szDir EndFunc Func RoundCorner() Local $RoundCorner = _WinAPI_CreateRoundRectRgn(0,0,$Width2,$Height2,$Width2/30,$Height2/30) _WinAPI_SetWindowRgn($PicGUI,$RoundCorner) Local $RoundCorner = _WinAPI_CreateRoundRectRgn(0,0,$Width2,$Height2,$Width2/30,$Height2/30) _WinAPI_SetWindowRgn($PicGUI,$RoundCorner) EndFunc Func TipsProc() If $TipsOnOff Then $TipsOnOff = 0 ToolTip("") EndIf ReduceMemory() ;memory free, set transparent makes memory increase, amount 2000KB EndFunc Func _WinProc($hWnd, $iMsg, $wParam, $lParam) Switch $iMsg Case $WM_PAINT Local $hDC, $tPAINTSTRUCT $hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT) _WinAPI_EndPaint($hWnd, $tPAINTSTRUCT) Return 0 EndSwitch Return _WinAPI_CallWindowProc($RegDllProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_WinProc Func ReduceMemory() If @AutoItPID <> -1 Then Local $AI_Handle = DllCall("kernel32.dll","int","OpenProcess","int",0x1f0fff,"int",False,"int",@AutoItPID) Local $AI_Return = DllCall("psapi.dll","int","EmptyWorkingSet","long",$AI_Handle[0]) DllCall("kernel32.dll","int","CloseHandle","int",$AI_Handle[0]) Else Local $AI_Return = DllCall("psapi.dll","int","EmptyWorkingSet","long",-1) EndIf Return $AI_Return[0] EndFunc Func OnAutoItExit() _WinAPI_SetWindowLong($DwnLabel,$GWL_WNDPROC,$RegDllProc) DllCallbackFree($RegDllCall) EndFunc Func _GDIPlus_DrawImageAsBackground($ihWnd,$iRetain_W,$iRetain_H,$iBK_Path,$iTrans) Local $LoadedImage,$iCurBKOriSize[2],$hScreenDC,$hMemDC,$hBitmap,$hSelObj,$tSize,$pSize,$tSource,$pSource,$tBlend,$pBlend $LoadedImage = _GDIPlus_ImageLoadFromFile($iBK_Path) $iCurBKOriSize[0] = _GDIPlus_ImageGetWidth($LoadedImage) $iCurBKOriSize[1] = _GDIPlus_ImageGetHeight($LoadedImage) ;此处应 检测尺寸是否大于 主窗口, 否则 激发相应 function ;~ $CurBKOriSize = $iCurBKOriSize ;储存切换背景图后的新背景图原尺寸 $hScreenDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScreenDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($LoadedImage) $hSelObj = _WinAPI_SelectObject($hMemDC,$hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize,"X",$iRetain_W) DllStructSetData($tSize,"Y",$iRetain_H) ;~ DllStructSetData($tSize,"X",_GDIPlus_ImageGetWidth($LoadedImage)) ;~ DllStructSetData($tSize,"Y",_GDIPlus_ImageGetWidth($LoadedImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend,"Alpha",$iTrans) DllStructSetData($tBlend,"Format",$AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($ihWnd,$hScreenDC,0,$pSize,$hMemDC,$pSource,0,$pBlend,$ULW_ALPHA) _WinAPI_ReleaseDC(0,$hScreenDC) _WinAPI_SelectObject($hMemDC,$hSelObj) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc The dimension of the background picture must bigger then: 950X600, in not, please amend the script. Kim.Y SampleScript.rar Edited July 17, 2011 by powerofos
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now