Jump to content

Recommended Posts

Posted (edited)

I have this function to set a png picture on a button:

func SetPicture_button($button, $path)
Global $hImage = _GDIPlus_ImageLoadFromFile($path)
Global $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($button), $BM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap))
EndFunc

but it only works if there's some text inside the button, if you remove the text, it will not work for some reason.

works:

$test = GUICtrlCreateButton("some text", 619, 16, 273, 153)
GUICtrlSetFont(-1, 30, 400, 0, "Verdana")
SetPicture_button($test, "mobil.png")

 

not working:

$test = GUICtrlCreateButton("", 619, 16, 273, 153)
GUICtrlSetFont(-1, 30, 400, 0, "Verdana")
SetPicture_button($test, "mobil.png")

 

any ideas :)?

Edited by legend
Posted

It depends on how you have defined the control $button.

If you add $BS_BITMAP to the GUICtrlCreateButton(), text will be ignored otherwise text will be added right to the image.

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

I normally use:

$Button_Find = GUICtrlCreatePic($InstallDir & "\search.bmp", 465, $Height + 4, 32, 32)
GUICtrlSetOnEvent($Button_Find, "Search")

I would imagine it works with png too.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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
  • Recently Browsing   0 members

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