Jump to content

Randoii

Members
  • Posts

    3
  • Joined

  • Last visited

Randoii's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks for your help, but i searched a little better on the forum here and found what i was looking for And thanks UEZ for this one: ;coded by UEZ 2011 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> Global $hGUI, $hImage, $hGraphic, $hImage Global Const $SC_DRAGMOVE = 0xF012 _GDIPlus_Startup() ; Load PNG image $hImage = _GDIPlus_ImageLoadFromFile("Audiograbber_512x512_transparent.png") $iWidth = _GDIPlus_ImageGetWidth($hImage) $iHeight = _GDIPlus_ImageGetHeight($hImage) ; Create GUI $hGUI = GUICreate("Show PNG", $iWidth, $iHeight, -1, -1, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST) $hGUI_child = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST + $WS_EX_MDICHILD, $hGUI) $hButton = GUICtrlCreateButton("Exit", $iWidth * 2 / 3, $iHeight * 2 / 3, 40, 40) GUISetBkColor(0xFFFFFF, $hGUI_child) GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_SHOW, $hGUI_child) SetTransparentBitmap($hGUI, $hImage) _WinAPI_SetLayeredWindowAttributes($hGUI_child, 0xFFFFFF, 0xff) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI_child) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2) DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hGraphic, "int", 4) _GDIPlus_GraphicsDrawString($hGraphic, "GDI+ Full Transparency", 0, $iHeight / 2 - 20, "Arial", 24) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $hButton GUIRegisterMsg($WM_LBUTTONDOWN, "") _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() GUIDelete($hGUI) ExitLoop EndSwitch WEnd Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN 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 Problem solved
  2. Thank you, I now got rid of the error, but still the gui is not transparent yet. Ill check the help file if i can find anything more on this.
  3. Hello all, I've been trying to modify a little script someone made. He/She made a GUI with a polygon. now i tried to make it transparent but it wont work, cant seem to figure out how to fix this. Original: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GDIPlus.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $hGUI, $hGraphic, $aPoints[4][2] ; Create GUI $hGUI = GUICreate("GDI+", 400, 300) GUISetState() ; Draw a polygon _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $aPoints[0][0] = 3 $aPoints[1][0] = 150 $aPoints[1][1] = 150 $aPoints[2][0] = 200 $aPoints[2][1] = 100 $aPoints[3][0] = 250 $aPoints[3][1] = 150 MsgBox(4096, "Information", "Fill Polygon") _GDIPlus_GraphicsFillPolygon($hGraphic, $aPoints) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>_Main Modified by me: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GDIPlus.au3> Opt('MustDeclareVars', 1) _Main() Func _Main() Local $hGUI, $hGraphic, $aPoints[4][2] Dim $DS_SETFOREGROUND, $WS_EX_TOPMOST, $WS_EX_TRANSPARENT ; Create GUI $hGUI = GUICreate("GDI+", 400, 300, $DS_SETFOREGROUND, $WS_EX_TOPMOST + $WS_EX_TRANSPARENT) GUISetState() ; Draw a polygon _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $aPoints[0][0] = 3 $aPoints[1][0] = 150 $aPoints[1][1] = 150 $aPoints[2][0] = 200 $aPoints[2][1] = 100 $aPoints[3][0] = 250 $aPoints[3][1] = 150 MsgBox(4096, "Information", "Fill Polygon") _GDIPlus_GraphicsFillPolygon($hGraphic, $aPoints) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>_Main
×
×
  • Create New...