DUNGYEUANH Posted April 8, 2014 Posted April 8, 2014 (edited) I'm writing a script which displays the png image in gui, the image size is not fixed (up to 50 * 50 pixels). So I had some problems with it:1. After pressing the button, image display correctly, but after minimum and restore windows, image display inaccurate (resized to 50 * 50)2. After the display the image 2, image 1 and image 2 overlapHow to solve this problem, thanks for the helpSorry, my english is bad expandcollapse popup#include <GDIPlus.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) _GDIPlus_Startup() #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 137, 67, 381, 238) GUISetOnEvent($GUI_EVENT_CLOSE, "_OnExit") $Pic1 = GUICtrlCreatePic("", 8, 8, 50, 50) $Button1 = GUICtrlCreateButton("Button1", 64, 8, 67, 25) GUICtrlSetOnEvent(-1, "_IMG") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func _OnExit() _GDIPlus_Shutdown() Exit EndFunc Func _IMG() MsgBox(0, "", "Show images 1") $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\icons1.png") $aBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject(GUICtrlSendMsg($Pic1, 0x0172, 0, $aBitmap)) _WinAPI_DeleteObject($aBitmap) MsgBox(0, "", "Show images 2") $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\icons2.png") $aBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject(GUICtrlSendMsg($Pic1, 0x0172, 0, $aBitmap)) _WinAPI_DeleteObject($aBitmap) EndFunc Edited April 8, 2014 by DUNGYEUANH
UEZ Posted April 9, 2014 Posted April 9, 2014 Resize the image to your desired dimension and send it to the picture control afterwards. 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
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