monoscout999 Posted August 26, 2011 Share Posted August 26, 2011 Hi forum i have made this function to skin one of my proyects, now i want to inprove the effect generated by this skin and turn the window semi transparent..the controls must remain opaque.expandcollapse popup#include <gdiplus.au3> #include <winapi.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> Global Const $STM_SETIMAGE = 0x172 $hGui = GuiCreate("Test Skin Functions",-1,200,-1,-1,$WS_POPUP) _SetGuiRoundCorners($hGUI, 40,false,true,true,false) _CreateCustomBk($hGui, 0x550555) GuiCtrlCreateLabel("TEST LABEL HERE!!!",50,50,120,20) GuictrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GuiCtrlSetColor(-1,0xFFFFFF) _CreateCustomGroupPic(100,100,200,75,0xff0000) GuiCtrlCreateLabel("AND HERE!!!",150,150,100,20) GuictrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GuiCtrlSetColor(-1,0xFFFFFF) GuiSetState() Do Until GuiGetMsg() = -3 Func _CreateCustomBk($hGui, $hexColor) Local $iWidth = _WinAPI_GetClientWidth($hGui) Local $iHeight = _WinAPI_GetClientHeight($hGui) Local $iPic = GuiCtrlCreatePic("", 0,0,$iWidth,$iHeight) Local $hHandle = GUICtrlGetHandle($iPic) _GDIPlus_Startup() local $oBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) local $hGraphics = _GDIPlus_ImageGetGraphicsContext($oBitmap) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2) local $hBrush = _GDIPlus_BrushCreateSolid("0xAA"&hex($hexColor,6)) _GDIPlus_GraphicsFillRect($hGraphics, 0, 0 ,$iWidth ,$iHeight, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, 2, 2 ,$iWidth - 6 ,$iHeight - 6, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0x22FFFFFF) local $iTimes = round($iWidth/50) local $aPoints[5][2] $aPoints[0][0] = 4 $aPoints[1][1] = $iHeight $aPoints[2][1] = $iHeight $aPoints[4][1] = 0 $aPoints[3][1] = 0 For $i = 0 to $iTimes local $Random1 = random(0,$iWidth,1) local $Random2 = random(30,50,1) $aPoints[1][0] = $Random1 $aPoints[2][0] = $Random1 + $Random2 $aPoints[4][0] = $aPoints[1][0] + 50 $aPoints[3][0] = $aPoints[2][0] + 50 _GDIPlus_GraphicsFillPolygon($hGraphics,$aPoints, $hBrush) $aPoints[1][0] -= $Random2/10 $aPoints[2][0] = $Random1 + $Random2 - ($Random2/10*2) $aPoints[3][0] = $aPoints[2][0] + 50 $aPoints[4][0] = $aPoints[1][0] + 50 _GDIPlus_GraphicsFillPolygon($hGraphics,$aPoints, $hBrush) Next local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($oBitmap,0x00000000) _winapi_deleteobject(GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)) _WinAPI_DeleteObject($hBitmap) _GDIPlus_brushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($oBitmap) _GDIPlus_Shutdown() GuiCtrlSetState($iPic, $GUI_DISABLE) EndFunc Func _CreateCustomGroupPic($ix, $iy, $Width, $iHeight, $hexColor) Local $iPic = GuiCtrlCreatePic("", $ix,$iy,$Width,$iHeight) Local $hHandle = GUICtrlGetHandle($iPic) _GDIPlus_Startup() local $oBitmap = _GDIPlus_BitmapCreateFromScan0($Width, $iHeight) local $hGraphics = _GDIPlus_ImageGetGraphicsContext($oBitmap) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2) local $hBrush = _GDIPlus_BrushCreateSolid("0x55"&hex($hexColor,6)) _GDIPlus_GraphicsFillRect($hGraphics, $ix, $iy ,$Width ,$iHeight, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, 2, 2 ,$Width- 4 ,$iHeight-4, $hBrush) local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($oBitmap,0x00000000) _winapi_deleteobject(GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)) _WinAPI_DeleteObject($hBitmap) _GDIPlus_brushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($oBitmap) _GDIPlus_Shutdown() GuiCtrlSetState($iPic, $GUI_DISABLE) EndFunc Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[6] EndFunc Func _SetGuiRoundCorners($hGUI, $iEllipse, $iLeftUp = True, $iLeftDown = True, $iRightUp = True, $iRightDown = True) Local $hCornerRgn Local $aGuiSize = WinGetPos($hGUI) Local $hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $aGuiSize[2], $aGuiSize[3], $iEllipse, $iEllipse) If $iLeftUp = false Then $hCornerRgn = _WinAPI_CreateRectRgn(0, 0, $aGuiSize[2] / 2, $aGuiSize[3] / 2) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR ) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iLeftDown = false Then $hCornerRgn = _WinAPI_CreateRectRgn(0, $aGuiSize[3] / 2, $aGuiSize[2] / 2, $aGuiSize[3]) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iRightUp = false Then $hCornerRgn = _WinAPI_CreateRectRgn($aGuiSize[2] / 2, 0, $aGuiSize[2], $aGuiSize[3] / 2) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iRightDown = false Then $hCornerRgn = _WinAPI_CreateRectRgn($aGuiSize[2] / 2, $aGuiSize[3] / 2, $aGuiSize[2]-1, $aGuiSize[3]-1) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf _WinAPI_SetWindowRgn($hGUI, $hRgn) EndFunc ;==>_SetGuiRoundCornersI can`t figure out how to do it... Link to comment Share on other sites More sharing options...
picea892 Posted August 26, 2011 Share Posted August 26, 2011 Awesome effect! This is the only way I know how to do it. expandcollapse popup#include <gdiplus.au3> #include <winapi.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> Global Const $STM_SETIMAGE = 0x172 $hGui = GuiCreate("Test Skin Functions",-1,200,-1,-1,$WS_POPUP) _SetGuiRoundCorners($hGUI, 40,false,true,true,false) _CreateCustomBk($hGui, 0x550555) _CreateCustomGroupPic(100,100,200,75,0xff0000) WinSetTrans("Test Skin Functions","",150) GuiSetState() $hGui_child = GuiCreate("Test Skin Functions",-1,200,-1,-1,$WS_POPUP,BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD),$hGui) GuiCtrlCreateLabel("TEST LABEL HERE!!!",50,50,120,20) GuictrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GuiCtrlSetColor(-1,0xFFFFFF) GuiCtrlCreateLabel("AND HERE!!!",150,150,100,20) GuictrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GuiCtrlSetColor(-1,0xFFFFFF) GUISetBkColor(0xABCDEF) _WinAPI_SetLayeredWindowAttributes($hGui_child, 0xABCDEF, 255) GuiSetState() Do Until GuiGetMsg() = -3 Func _CreateCustomBk($hGui, $hexColor) Local $iWidth = _WinAPI_GetClientWidth($hGui) Local $iHeight = _WinAPI_GetClientHeight($hGui) Local $iPic = GuiCtrlCreatePic("", 0,0,$iWidth,$iHeight) Local $hHandle = GUICtrlGetHandle($iPic) _GDIPlus_Startup() local $oBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) local $hGraphics = _GDIPlus_ImageGetGraphicsContext($oBitmap) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2) local $hBrush = _GDIPlus_BrushCreateSolid("0xAA"&hex($hexColor,6)) _GDIPlus_GraphicsFillRect($hGraphics, 0, 0 ,$iWidth ,$iHeight, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, 2, 2 ,$iWidth - 6 ,$iHeight - 6, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0x22FFFFFF) local $iTimes = round($iWidth/50) local $aPoints[5][2] $aPoints[0][0] = 4 $aPoints[1][1] = $iHeight $aPoints[2][1] = $iHeight $aPoints[4][1] = 0 $aPoints[3][1] = 0 For $i = 0 to $iTimes local $Random1 = random(0,$iWidth,1) local $Random2 = random(30,50,1) $aPoints[1][0] = $Random1 $aPoints[2][0] = $Random1 + $Random2 $aPoints[4][0] = $aPoints[1][0] + 50 $aPoints[3][0] = $aPoints[2][0] + 50 _GDIPlus_GraphicsFillPolygon($hGraphics,$aPoints, $hBrush) $aPoints[1][0] -= $Random2/10 $aPoints[2][0] = $Random1 + $Random2 - ($Random2/10*2) $aPoints[3][0] = $aPoints[2][0] + 50 $aPoints[4][0] = $aPoints[1][0] + 50 _GDIPlus_GraphicsFillPolygon($hGraphics,$aPoints, $hBrush) Next local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($oBitmap,0x00000000) _winapi_deleteobject(GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)) _WinAPI_DeleteObject($hBitmap) _GDIPlus_brushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($oBitmap) _GDIPlus_Shutdown() GuiCtrlSetState($iPic, $GUI_DISABLE) EndFunc Func _CreateCustomGroupPic($ix, $iy, $Width, $iHeight, $hexColor) Local $iPic = GuiCtrlCreatePic("", $ix,$iy,$Width,$iHeight) Local $hHandle = GUICtrlGetHandle($iPic) _GDIPlus_Startup() local $oBitmap = _GDIPlus_BitmapCreateFromScan0($Width, $iHeight) local $hGraphics = _GDIPlus_ImageGetGraphicsContext($oBitmap) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2) local $hBrush = _GDIPlus_BrushCreateSolid("0x55"&hex($hexColor,6)) _GDIPlus_GraphicsFillRect($hGraphics, $ix, $iy ,$Width ,$iHeight, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, 2, 2 ,$Width- 4 ,$iHeight-4, $hBrush) local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($oBitmap,0x00000000) _winapi_deleteobject(GUICtrlSendMsg($iPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap)) _WinAPI_DeleteObject($hBitmap) _GDIPlus_brushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($oBitmap) _GDIPlus_Shutdown() GuiCtrlSetState($iPic, $GUI_DISABLE) EndFunc Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[6] EndFunc Func _SetGuiRoundCorners($hGUI, $iEllipse, $iLeftUp = True, $iLeftDown = True, $iRightUp = True, $iRightDown = True) Local $hCornerRgn Local $aGuiSize = WinGetPos($hGUI) Local $hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $aGuiSize[2], $aGuiSize[3], $iEllipse, $iEllipse) If $iLeftUp = false Then $hCornerRgn = _WinAPI_CreateRectRgn(0, 0, $aGuiSize[2] / 2, $aGuiSize[3] / 2) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR ) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iLeftDown = false Then $hCornerRgn = _WinAPI_CreateRectRgn(0, $aGuiSize[3] / 2, $aGuiSize[2] / 2, $aGuiSize[3]) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iRightUp = false Then $hCornerRgn = _WinAPI_CreateRectRgn($aGuiSize[2] / 2, 0, $aGuiSize[2], $aGuiSize[3] / 2) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iRightDown = false Then $hCornerRgn = _WinAPI_CreateRectRgn($aGuiSize[2] / 2, $aGuiSize[3] / 2, $aGuiSize[2]-1, $aGuiSize[3]-1) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf _WinAPI_SetWindowRgn($hGUI, $hRgn) EndFunc ;==>_SetGuiRoundCorners Link to comment Share on other sites More sharing options...
monoscout999 Posted August 26, 2011 Author Share Posted August 26, 2011 @picea892 i knew that method WinSetTrans() but i want to keep the controls color opaque. thanks anyway. Link to comment Share on other sites More sharing options...
picea892 Posted August 26, 2011 Share Posted August 26, 2011 @picea892 i knew that method WinSetTrans() but i want to keep the controls color opaque. thanks anyway.Look again...that was only part of it. There is a child gui where the controls are being housed that is not semitransparent. Link to comment Share on other sites More sharing options...
monoscout999 Posted August 26, 2011 Author Share Posted August 26, 2011 Look again...that was only part of it. There is a child gui where the controls are being housed that is not semitransparent.You have right! the letters seems a quite rare, i don`t like how the letter looks... i will use this method until i find out how to do it without a second GUI... I will try to adapt the SetBitmap() function from L0ader to set the window background. thanks picea892 Link to comment Share on other sites More sharing options...
picea892 Posted August 26, 2011 Share Posted August 26, 2011 This may help you;#include <FontConstants.au3> Global Const $NONANTIALIASED_QUALITY = 3 GUICtrlSetFont($viewTable, 14, 550, Default, "Arial", $NONANTIALIASED_QUALITY) Link to comment Share on other sites More sharing options...
monoscout999 Posted August 26, 2011 Author Share Posted August 26, 2011 (edited) This may help you ;#include <FontConstants.au3> Global Const $NONANTIALIASED_QUALITY = 3 GUICtrlSetFont($viewTable, 14, 550, Default, "Arial", $NONANTIALIASED_QUALITY) Genius... that solve all the problem. thanks picea!! EDIT i change the image Edited August 26, 2011 by monoscout999 Link to comment Share on other sites More sharing options...
picea892 Posted August 26, 2011 Share Posted August 26, 2011 Glad I could help. You have one awesome script there...I need to study it. Link to comment Share on other sites More sharing options...
monoscout999 Posted August 26, 2011 Author Share Posted August 26, 2011 Glad I could help.You have one awesome script there...I need to study it.say thanks to UEZ he is the one that told me about many of the things that i use there i only try to implement in a creative way things that i learn. Link to comment Share on other sites More sharing options...
monoscout999 Posted August 26, 2011 Author Share Posted August 26, 2011 I dont like being so annoying but i think that the effect is missed if i use the winsettrans method... because the part where the rays of brightness effects match with other rays... must be more white that others.. but this way the effect is loss. Link to comment Share on other sites More sharing options...
UEZ Posted August 26, 2011 Share Posted August 26, 2011 Here another fast hack: expandcollapse popup;another fast hack by UEZ 2011 #include <GDIPlus.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) _GDIPlus_Startup() Global Const $SC_DRAGMOVE = 0xF012 $W = -1 $H = 200 Global Const $hGUI = GUICreate("GDI+ Test by UEZ 2011", $W, $H, -1, -1, $WS_POPUP, $WS_EX_LAYERED) Global Const $hGUI_Child = GUICreate("", $W, $H, 0, 0, $WS_POPUP, $WS_EX_MDICHILD + $WS_EX_LAYERED, $hGUI) GUISetBkColor(0xABCDEF, $hGUI_Child) GUISwitch($hGUI_Child) Global Const $idButton = GUICtrlCreateButton("Exit", 70, 10, 50, 50) GUICtrlSetOnEvent(-1, "_Exit") Global Const $idLabel = GuiCtrlCreateLabel("TEST LABEL HERE!!!",150,140,107,12) GUICtrlSetColor(-1, 0xF0F0F0) GUICtrlSetBkColor(-1, -2) _WinAPI_SetLayeredWindowAttributes($hGUI_Child, 0xABCDEF, 0xFF) GUISetState(@SW_SHOW, $hGUI_Child) GUISetState(@SW_SHOW, $hGUI) _SetGuiRoundCorners($hGUI, 40,false,true,true,false) Global Const $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global Const $hBitmap = _CreateCustomBk($hGui, 0x550555) Global Const $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _CreateCustomGroupPic($hContext, 100,100,200,75,0xff0000) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $W, $H) SetTransparentBitmap($hGUI, $hBitmap, 0xD0) GUISetOnEvent(-3, "_Exit") GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") While Sleep(2^16) WEnd Func _Exit() _GDIPlus_BitmapDispose ($hBitmap) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() GUIDelete($hGUI_Child) GUIDelete($hGUI) Exit EndFunc Func _CreateCustomBk($hGui, $hexColor, $alpha = "0xAA") Local $iWidth = _WinAPI_GetClientWidth($hGui) Local $iHeight = _WinAPI_GetClientHeight($hGui) local $oBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) local $hGraphics = _GDIPlus_ImageGetGraphicsContext($oBitmap) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2) local $hBrush = _GDIPlus_BrushCreateSolid($alpha&hex($hexColor,6)) _GDIPlus_GraphicsFillRect($hGraphics, 0, 0 ,$iWidth ,$iHeight, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, 2, 2 ,$iWidth - 6 ,$iHeight - 6, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0x22FFFFFF) local $iTimes = round($iWidth/50) local $aPoints[5][2] $aPoints[0][0] = 4 $aPoints[1][1] = $iHeight $aPoints[2][1] = $iHeight $aPoints[4][1] = 0 $aPoints[3][1] = 0 For $i = 0 to $iTimes local $Random1 = random(0,$iWidth,1) local $Random2 = random(30,50,1) $aPoints[1][0] = $Random1 $aPoints[2][0] = $Random1 + $Random2 $aPoints[4][0] = $aPoints[1][0] + 50 $aPoints[3][0] = $aPoints[2][0] + 50 _GDIPlus_GraphicsFillPolygon($hGraphics,$aPoints, $hBrush) $aPoints[1][0] -= $Random2/10 $aPoints[2][0] = $Random1 + $Random2 - ($Random2/10*2) $aPoints[3][0] = $aPoints[2][0] + 50 $aPoints[4][0] = $aPoints[1][0] + 50 _GDIPlus_GraphicsFillPolygon($hGraphics,$aPoints, $hBrush) Next _GDIPlus_brushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) Return $oBitmap EndFunc Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[6] EndFunc Func _CreateCustomGroupPic($hGraphics, $ix, $iy, $Width, $iHeight, $hexColor) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2) local $hBrush = _GDIPlus_BrushCreateSolid("0x55"&hex($hexColor,6)) _GDIPlus_GraphicsFillRect($hGraphics, $ix, $iy ,$Width ,$iHeight, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, 2, 2 ,$Width- 4 ,$iHeight-4, $hBrush) _GDIPlus_brushDispose($hBrush) EndFunc Func _SetGuiRoundCorners($hGUI, $iEllipse, $iLeftUp = True, $iLeftDown = True, $iRightUp = True, $iRightDown = True) Local $hCornerRgn Local $aGuiSize = WinGetPos($hGUI) Local $hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $aGuiSize[2], $aGuiSize[3], $iEllipse, $iEllipse) If $iLeftUp = false Then $hCornerRgn = _WinAPI_CreateRectRgn(0, 0, $aGuiSize[2] / 2, $aGuiSize[3] / 2) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR ) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iLeftDown = false Then $hCornerRgn = _WinAPI_CreateRectRgn(0, $aGuiSize[3] / 2, $aGuiSize[2] / 2, $aGuiSize[3]) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iRightUp = false Then $hCornerRgn = _WinAPI_CreateRectRgn($aGuiSize[2] / 2, 0, $aGuiSize[2], $aGuiSize[3] / 2) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iRightDown = false Then $hCornerRgn = _WinAPI_CreateRectRgn($aGuiSize[2] / 2, $aGuiSize[3] / 2, $aGuiSize[2]-1, $aGuiSize[3]-1) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf _WinAPI_SetWindowRgn($hGUI, $hRgn) EndFunc ;==>_SetGuiRoundCorners Func SetTransparentBitmap($hGUI, $hImage, $iOpacity = 0xFF) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hGUI, $hMemDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetTransparentBitmap Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN Do you mean something like that? I'm unfortunately not so creative to show GDI+ in a much nicer way...Sometimes the code is nothing against a simple but nice GUI. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
monoscout999 Posted August 26, 2011 Author Share Posted August 26, 2011 (edited) Here another fast hack: expandcollapse popup;another fast hack by UEZ 2011 #include <GDIPlus.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) _GDIPlus_Startup() Global Const $SC_DRAGMOVE = 0xF012 $W = -1 $H = 200 Global Const $hGUI = GUICreate("GDI+ Test by UEZ 2011", $W, $H, -1, -1, $WS_POPUP, $WS_EX_LAYERED) Global Const $hGUI_Child = GUICreate("", $W, $H, 0, 0, $WS_POPUP, $WS_EX_MDICHILD + $WS_EX_LAYERED, $hGUI) GUISetBkColor(0xABCDEF, $hGUI_Child) GUISwitch($hGUI_Child) Global Const $idButton = GUICtrlCreateButton("Exit", 70, 10, 50, 50) GUICtrlSetOnEvent(-1, "_Exit") Global Const $idLabel = GuiCtrlCreateLabel("TEST LABEL HERE!!!",150,140,107,12) GUICtrlSetColor(-1, 0xF0F0F0) GUICtrlSetBkColor(-1, -2) _WinAPI_SetLayeredWindowAttributes($hGUI_Child, 0xABCDEF, 0xFF) GUISetState(@SW_SHOW, $hGUI_Child) GUISetState(@SW_SHOW, $hGUI) _SetGuiRoundCorners($hGUI, 40,false,true,true,false) Global Const $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global Const $hBitmap = _CreateCustomBk($hGui, 0x550555) Global Const $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) _CreateCustomGroupPic($hContext, 100,100,200,75,0xff0000) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $W, $H) SetTransparentBitmap($hGUI, $hBitmap, 0xD0) GUISetOnEvent(-3, "_Exit") GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") While Sleep(2^16) WEnd Func _Exit() _GDIPlus_BitmapDispose ($hBitmap) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() GUIDelete($hGUI_Child) GUIDelete($hGUI) Exit EndFunc Func _CreateCustomBk($hGui, $hexColor, $alpha = "0xAA") Local $iWidth = _WinAPI_GetClientWidth($hGui) Local $iHeight = _WinAPI_GetClientHeight($hGui) local $oBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight) local $hGraphics = _GDIPlus_ImageGetGraphicsContext($oBitmap) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2) local $hBrush = _GDIPlus_BrushCreateSolid($alpha&hex($hexColor,6)) _GDIPlus_GraphicsFillRect($hGraphics, 0, 0 ,$iWidth ,$iHeight, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, 2, 2 ,$iWidth - 6 ,$iHeight - 6, $hBrush) _GDIPlus_BrushSetSolidColor($hBrush, 0x22FFFFFF) local $iTimes = round($iWidth/50) local $aPoints[5][2] $aPoints[0][0] = 4 $aPoints[1][1] = $iHeight $aPoints[2][1] = $iHeight $aPoints[4][1] = 0 $aPoints[3][1] = 0 For $i = 0 to $iTimes local $Random1 = random(0,$iWidth,1) local $Random2 = random(30,50,1) $aPoints[1][0] = $Random1 $aPoints[2][0] = $Random1 + $Random2 $aPoints[4][0] = $aPoints[1][0] + 50 $aPoints[3][0] = $aPoints[2][0] + 50 _GDIPlus_GraphicsFillPolygon($hGraphics,$aPoints, $hBrush) $aPoints[1][0] -= $Random2/10 $aPoints[2][0] = $Random1 + $Random2 - ($Random2/10*2) $aPoints[3][0] = $aPoints[2][0] + 50 $aPoints[4][0] = $aPoints[1][0] + 50 _GDIPlus_GraphicsFillPolygon($hGraphics,$aPoints, $hBrush) Next _GDIPlus_brushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) Return $oBitmap EndFunc Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) Return $aResult[6] EndFunc Func _CreateCustomGroupPic($hGraphics, $ix, $iy, $Width, $iHeight, $hexColor) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2) local $hBrush = _GDIPlus_BrushCreateSolid("0x55"&hex($hexColor,6)) _GDIPlus_GraphicsFillRect($hGraphics, $ix, $iy ,$Width ,$iHeight, $hBrush) _GDIPlus_GraphicsFillRect($hGraphics, 2, 2 ,$Width- 4 ,$iHeight-4, $hBrush) _GDIPlus_brushDispose($hBrush) EndFunc Func _SetGuiRoundCorners($hGUI, $iEllipse, $iLeftUp = True, $iLeftDown = True, $iRightUp = True, $iRightDown = True) Local $hCornerRgn Local $aGuiSize = WinGetPos($hGUI) Local $hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $aGuiSize[2], $aGuiSize[3], $iEllipse, $iEllipse) If $iLeftUp = false Then $hCornerRgn = _WinAPI_CreateRectRgn(0, 0, $aGuiSize[2] / 2, $aGuiSize[3] / 2) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR ) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iLeftDown = false Then $hCornerRgn = _WinAPI_CreateRectRgn(0, $aGuiSize[3] / 2, $aGuiSize[2] / 2, $aGuiSize[3]) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iRightUp = false Then $hCornerRgn = _WinAPI_CreateRectRgn($aGuiSize[2] / 2, 0, $aGuiSize[2], $aGuiSize[3] / 2) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf If $iRightDown = false Then $hCornerRgn = _WinAPI_CreateRectRgn($aGuiSize[2] / 2, $aGuiSize[3] / 2, $aGuiSize[2]-1, $aGuiSize[3]-1) _WinAPI_CombineRgn($hRgn, $hRgn, $hCornerRgn, $RGN_OR) _WinAPI_DeleteObject($hCornerRgn) EndIf _WinAPI_SetWindowRgn($hGUI, $hRgn) EndFunc ;==>_SetGuiRoundCorners Func SetTransparentBitmap($hGUI, $hImage, $iOpacity = 0xFF) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hGUI, $hMemDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetTransparentBitmap Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN Do you mean something like that? I'm unfortunately not so creative to show GDI+ in a much nicer way...Sometimes the code is nothing against a simple but nice GUI. Br, UEZ I agree. but i will try to simpleficate a little... anyway these functions will be in a UDF so this is one-time-writing-script. Thanks to both Edited August 26, 2011 by monoscout999 Link to comment Share on other sites More sharing options...
picea892 Posted August 26, 2011 Share Posted August 26, 2011 I dont like being so annoying but i think that the effect is missed if i use the winsettrans method... because the part where the rays of brightness effects match with other rays... must be more white that others.. but this way the effect is loss. Hmmm. if Uez's work doesn't meet your needs, I think you might be looking to add more gui's in a layered sort of fashion. An extreme example that demonstrates my point....I think this is not a good approach but throw it in just for a laugh. #include <WindowsConstants.au3> Global $array[255] $j = 300 For $i = 0 to 255 - 1 $array[$i] = guicreate("Title", 2, 300, $j, 300,$WS_POPUP+$WS_DISABLED,$WS_EX_TOOLWINDOW+$WS_EX_TOPMOST) WinSetTrans($array[$i], "", $i) guisetstate() $j += 1 next While 1 Sleep(100) WEnd Link to comment Share on other sites More sharing options...
monoscout999 Posted August 26, 2011 Author Share Posted August 26, 2011 nice demostration picea, the effect that i am looking is that!, but like a fantasy glass reflecting light. the GUI method(your example) is heavy and slow, so the Pic was my best choice Link to comment Share on other sites More sharing options...
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