Jump to content

..


Recommended Posts

Is it possible to get the label to appear over top of the PNG image?

Is this what you want?

#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GDIPlus.au3>
#include <Memory.au3>
#include <GUIConstants.au3> ;====>Added

_GDIPlus_Startup()

GUICreate("Label over PNG Test", 250, 250)

Global $picture = GUICtrlCreatePic("", 10, 10, 50, 50, 14), $hBitmap ;====>Order changed
Global $label = GUICtrlCreateLabel("This is a label", 10, 25, 100, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ;====>Added (to get transparant background instead of grey...)

GUICtrlSetState(-1, @SW_DISABLE)

Global $bImage = '0x89504E470D0A1A0A0000000D494844520000003200000032080300000029E178830000001974455874536F6674776172650041646F626520496D616765526561647971C9653C000000FF504C5445FAFAFAAFBDCCF9F9F9F5F6F7BFCAD6B6C3D0F4F5F6BEC9D5D4DBE3F9FAFAB5C2CFF8F8F9B7C3D1E1E6EBB9C5D2BAC6D3EBEEF1B0BECDF0F2F4F3F4F5E0E5EACDD5DED9DFE6BDC9D5F8F9F9F6F7F8E8EBEFDAE0E6B0BDCCC2CDD8F3F4F6EDF0F2E1E5EAC1CCD7E6E9EED5DCE3C0CBD7DEE4E9B1BFCDD6DDE4B4C1CFC7D0DAF4F5F7E2E6EBBCC8D4D1D8E1D3DAE2DCE2E8B7C4D1C7D0DBEEF0F3D8DFE5C2CCD8C8D2DCECEEF1DFE4E9EFF1F3F6F7F7DFE4EAB3C0CFEDEFF2E7EBEEF1F3F5B1BECDD1D9E1E3E8ECDDE2E8CAD3DCC9D2DCC8D1DBC0CBD6B5C2D0D2D9E1C4CED9CBD4DDE6EAEED2DAE2DDE3E9B2BFCEEFF1F4BDC8D4B8C4D1C6D0DAB2C0CECCD4DD6FB0BEE2000001424944415478DAECD56953C23010066036696829B50708A8080822DEF77DDFF77DFCFFDFA2A338244BDB5D3E3AE3FBB9CF64D2BCD96432FFF933297CF84AA9E0A4C0168F1EFCC4BB19E5892AF4F2B6CB11134F1A810BC1D8870B460E69E298021E68B2898895A384784164A54E91FA2B22D0A248788CC91045B63A984C5144FA03136163B24DFEE47324661A24292362D38D0923935468B2F68E4E9F26A269923B46F9974CB2CE2063E3BAD83F601051D3498D75914FF565CA2C92D70B70C69B17931A19E6ADD21EA4FADFD9D3B7EFDF8FD022BB609C4B642DB6F2849885BE58CB324534AE202E8193346A7355171272FB1C2B8AAB909C6027AE5D16A4E5B26F084AA7932AE0BA88C47C05A8984D982B019DB67EAAD2064EB4F6C80D9680666F0E4CF30444E1AF38524C02A5B8FB911E95ED16D1631370BA4F305F80FBF5FDA70003000DBA1506A026E76C0000000049454E44AE426082'
Global $hImage = _BinaryToCtrl($bImage)

GUISetState()
While 1
    If GUIGetMsg() = -3 Then ExitLoop
WEnd

_WinAPI_DeleteObject($hBitmap)
_GDIPlus_Shutdown()

Func _BinaryToCtrl($s_Binary)
    Local $b_PicData = Binary($s_Binary)
    Local $i_PicLength = BinaryLen($b_PicData)
    Local $t_PicStruct = DllStructCreate("byte[" & $i_PicLength & "]")
    DllStructSetData($t_PicStruct, 1, $b_PicData)
    Local $p_PicMemory = DllStructGetPtr($t_PicStruct)
    Local $h_Memory = _MemGlobalAlloc($i_PicLength, 2)
    Local $p_Memory = _MemGlobalLock($h_Memory)
    _MemMoveMemory($p_PicMemory, $p_Memory, $i_PicLength)
    _MemGlobalUnlock($h_Memory)
    Local $p_Stream = DllCall("Ole32.dll", "int", "CreateStreamOnHGlobal", "int", $h_Memory, "long", 1, "Int*", 0)
    $p_Stream = $p_Stream[3]
    Local $p_Bitmap = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromStream", "ptr", $p_Stream, "int*", 0)
    $p_Bitmap = $p_Bitmap[2]
    $t_PicStruct = 0
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($p_Bitmap)
    _GDIPlus_ImageDispose($p_Bitmap)
    Local $h_Wnd = GUICtrlGetHandle($picture)
    Local $a_Ret = DllCall("User32.dll", "hwnd", "SendMessage", "hwnd", $h_Wnd, "int", 0x0172, "int", 0, "int", $hBitmap)
    If $a_Ret[0] <> 0 Then _WinAPI_DeleteObject($a_Ret[0])
EndFunc

M

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...