Sign in to follow this  
Followers 0
mikell

GUICtrlSetImage() forces Pic control to resize

7 posts in this topic

#1 ·  Posted (edited)

Hello

GUICtrlSetImage() forces a pic control created with GUICtrlCreatePic() to resize, and I can't find why.

I searched evrywhere on the forum and the only solution I could find to work was to delete and recreate the pic control... it works but makes my image flicker

The strangest thing is that I made this script and compiled it in 2009 and this old exe works nice, while the .au3 I used to compile it actually doesn't work....

Help please !

Edit :

If I put no style or exstyle for the border of my Pic, then no problem.

it occurs only if I use $SS_SUNKEN, $WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE, etc

Is there a way to solve this ?

Edited by mikell

Share this post


Link to post
Share on other sites



Works fine for me. Did you declare the width and height of the control explicitly?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$s_AU_Path = StringTrimRight(@AutoItExe, StringLen(@AutoItExe) - StringInStr(@AutoItExe, "\", 2, -1)) & "\Examples\GUI"

GUICreate("My GUI picture", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered

GUISetBkColor(0xE0FFFF)
$n = GUICtrlCreatePic($s_AU_Path & "\mslogo.jpg", 50, 50, 255, 40)
GUISetState()

Sleep(2000)
GUICtrlSetImage($n, $s_AU_Path & "\msoobe.jpg")

Sleep(2000)
GUICtrlSetImage($n, $s_AU_Path & "\logo4.gif")


; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

GUIDelete()

Share this post


Link to post
Share on other sites

Yes I did

The problem occurs when I give a border style to the pic

On your script with this line, you can see the pic grow :huh2:

$n = GUICtrlCreatePic($s_AU_Path & "\mslogo.jpg", 50, 50, 255, 40, $SS_SUNKEN)

Share this post


Link to post
Share on other sites

Yes I did

The problem occurs when I give a border style to the pic

On your script with this line, you can see the pic grow :huh2:

$n = GUICtrlCreatePic($s_AU_Path & "\mslogo.jpg", 50, 50, 255, 40, $SS_SUNKEN)

use the SS_CENTERIMAGE style

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

$s_AU_Path = StringTrimRight(@AutoItExe, StringLen(@AutoItExe) - StringInStr(@AutoItExe, "\", 2, -1)) & "\Examples\GUI"

GUICreate("My GUI picture", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU)
GUISetBkColor(0xE0FFFF)

;draw black border around pic control to highlight
;the image size/placement issue without the SS_CENTERIMAGE style
GUICtrlCreateLabel("", 48, 48, 258, 43, $SS_BLACKFRAME)
GuiCtrlSetState(-1,$GUI_DISABLE)

$n = GUICtrlCreatePic($s_AU_Path & "\mslogo.jpg", 50, 50, 255, 40, BitOR($SS_CENTERIMAGE, $SS_SUNKEN), $WS_EX_CLIENTEDGE)
GUISetState()

Sleep(2000)
GUICtrlSetImage($n, $s_AU_Path & "\msoobe.jpg")

Sleep(2000)
GUICtrlSetImage($n, $s_AU_Path & "\logo4.gif")


; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

GUIDelete()

I see fascists...

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks a lot !

This $SS_CENTERIMAGE feature is not very explicite when reading the helpfile ...

Edit: though I still don't understand why my 2009 script didn't get this trouble

Edited by mikell

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

It's to be expected as AutoIt has been updated quite a bit since 2009 :huh2:

Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I know this a bit :huh2:

But I wonder what precisely in the update(s) caused the trouble

Curiosity only For educational purpose ;)

Edited by mikell

Share this post


Link to post
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
Sign in to follow this  
Followers 0