Okay... I tried looking up on how to do this in the forum, but nothing I found with GuiControl, Move quite addressed my needs.
What I want to do is take a picture control and resize the image like it's a progress bar. Yes, I know there are progress bar controls in AHK, but I wanted to get creative
I'm actually trying to use an animated GIFs, but not sure if the function is getting in the way. So for testin purpose, I took one of the other images to see if I could resize it and found I couldn't.
If anyone could help, I'd greatly appreciate it.
So here's the main code (and it's not cleaned up any and the tabs are for easy readability in my editor):
GUIWidth := 640 Loop, 7 { hGui := WinExist() Gui, %A_Index%: Color, 000011 If ( A_Index != 1 ) Gui, %A_Index%: +LastFound -Caption +ToolWindow +Owner 1 else Gui, %A_Index%: +LastFound -Caption +ToolWindow } Gui, 1: Add, Picture,Transparent w%GUIWidth% h-1 x0 y0 , LauncherUI-L3.png ;~ Gui, 1: Add, Picture, Transparent w%GUIWidth% h-1 x0 y0 , LauncherUI-L1.png ;~ Gui, 2: Add, Picture, Transparent w%GUIWidth% h-1 x0 y0 , LauncherUI-L2.png Gui, 4: Font, cWhite s12, Verdana Gui, 4: Add, Picture, Transparent w160 h160 x10 y10 , Logo.png Gui, 4: Add, Text, Transparent x180 y10 , LauncherUI: Gui, 4: Add, Text, Transparent xp y30 , Setting up .... Gui, 4: Add, Text, Transparent xp y130 , Actions: Gui, 4: Font, cGray s9, Tahoma Gui, 4: Add, ListBox, Transparent w450 r5 xp yp+20 vColorChoice, Red|Green|Blue|Black|White Gui, 4: Font, cWhite s12, Verdana Gui, 4: Add, Text, Transparent x21 y237 , Progress of Actions: ;~ AnimatedGifControl("5", A_ScriptDir . "\Bar-02.gif", "y255 x21 w550 h23 bgc777700", "ProgA") AnimatedGifControl("5", A_ScriptDir . "\Bar-02.gif", "y280 x21 w110 h23 bgc007777", "ProgB") Gui, 5: Add, Picture, Transparent w-1 y170 x21 w110 h23 vProgA, LauncherUI-L4.png Gui, 6: Add, Picture, Transparent w-1 h25 x10 y255 , LauncherUI-L4.png Gui, 6: Add, Picture, Transparent w-1 h25 x10 y280 , LauncherUI-L4.png ;~ Gui, 7: Add, Picture, Transparent w%GUIWidth% h-1 x0 y0 hwndhText12 , LauncherUI-L3.png Loop, 7 { Gui, %A_Index%: Show,w640 h320 Gui, %A_Index%: +LastFound hGui := WinExist() WinSet, Redraw,, ahk_id %hGui% WinSet, TransColor, 000011 Sleep, 500 } LongProg := TotalFiles := 5 FileSize := 128 Loop, %TotalFiles% { Loop, %FileSize% { ShortProg := 110 + ( A_Index / FileSize * 440 ) GuiControl, Move, ProgA, w%ShortProg% TrayTip,,ShortProg = %ShortProg%`nLongProg = %LongProg% Sleep, 1 } LongProg := 110 + ( A_Index / TotalFiles * 440 ) GuiControl, Move, ProgB, w%LongProg% Sleep, 100 } MsgBox, done Return #Include, AnimatedGifControl_2.ahk
Here's the "AnimatedGifControl_2.ahk" include (slightly modified from the original found elsewhere in the forums):
AnimatedGifControl(GuiNameOrHwnd, GifFilePath, ControlOptions="", hCntL="ProgZ") { Static Static CallCount := 0 Local pos, ObjectName, bgColor ; Create a variable name for ActiveX Object ObjectName := "WB" ++CallCount ; Retrieve the given image dimenstions AnimatedGifControl_GetImageDimensions(GifFilePath, GifWidth, GifHeight) if RegExMatch(ControlOptions, "O)(\s|^)(w(\d+))(\s|$)", oM) { GifWidth := oM.Value(3) StringReplace, ControlOptions, ControlOptions, % oM.Value(2), ; Remove the found option } if pos := RegExMatch(ControlOptions, "O)(\s|^)(h(\d+))(\s|$)", oM) { GifHeight := oM.Value(3) StringReplace, ControlOptions, ControlOptions, % oM.Value(2), ; Remove the found option } ; Retrieve the background color option if RegExMatch(ControlOptions, "O)(\s|^)(bgc(\w{6}))(\s|$)", oM) { bgColor := oM.Value(3) StringReplace, ControlOptions, ControlOptions, % oM.Value(2), ; Remove the found option } else bgColor := AnimatedGifControl_GetSysColor(15) ;COLOR_3DFACE :Face color for three-dimensional display elements and for dialog box backgrounds. ; Add the Gif Animation Control Gui, %GuiNameOrHwnd%: Add, ActiveX, v%hCntL% v%ObjectName% w%GifWidth% h%GifHeight% Disabled %ControlOptions% Transparent, Shell.Explorer ;Mozilla.Browser ;~ Gui, %GuiNameOrHwnd%: Add, ActiveX, % "hwndhText" HwndhCntL "v" ObjectName " w" GifWidth " h" GifHeight " Disabled " ControlOptions, Shell.Explorer ;Mozilla.Browser %ObjectName%.Navigate("about:blank") ;How Do you Stretch a Background Image in a Web Page ;http://webdesign.about.com/od/css3/f/blfaqbgsize.htm %ObjectName%.Document.Write(" (Ltrim <html> <header> <style type='text/css'> img#bg { position:fixed; top:0; left:0; width:100%; height:100%; } </style> <!--[if IE 6]> <![endif]--> <!--[if IE 6]> <style type='text/css'> html { overflow-y: hidden; } body { overflow-y: hidden; } img#bg { position:absolute; z-index:-1; } #content { position:static; } </style> <![endif]--> </header> <body style='height: 100%; width: 100%; margin: 0; padding: 0; overflow-x: hidden; overflow-y: hidden; background-color: #" bgColor ";' /> <img src='" GifFilePath "' id='bg' /> </body> </html> )") %ObjectName%.Document.close %ObjectName% := "" ;release the object Return } AnimatedGifControl_GetImageDimensions(ImgPath, Byref width, Byref height) { DHW := A_DetectHiddenWIndows DetectHiddenWindows, ON Gui, AnimatedGifControl_GetImageDimensions: Add, Picture, hwndhWndImage, % ImgPath GuiControlGet, Image, AnimatedGifControl_GetImageDimensions:Pos, % hWndImage Gui, AnimatedGifControl_GetImageDimensions: Destroy DetectHiddenWindows, % DHW width := ImageW, height := ImageH } AnimatedGifControl_GetSysColor(d_element) { ;Thanks SKAN ;http://www.autohotkey.com/forum/post-66521.html#66521 A_FI:=A_FormatInteger SetFormat, Integer, Hex BGR:=DllCall("GetSysColor" ,Int,d_element)+0x1000000 SetFormat,Integer,%A_FI% StringMid,R,BGR,8,2 StringMid,G,BGR,6,2 StringMid,B,BGR,4,2 RGB := R G B StringUpper,RGB,RGB Return RGB } /* by A_Samurai 2012/01/25 version 1.0.5 Added: - background color option: bgcNNNNNN where Ns is 6-digit RGB color value. 2012/01/24 version 1.0.4 Added: - image resize support 2012/01/22 version 1.0.3 Removed: - the ObjectName parameter 2012/01/22 version 1.0.2 Fixed: - a bug that does not retrieve image dimensions properly. 2012/01/22 version 1.0.1 Fixed: - to use IE components from Firefox. Changed: - to allow wN and hN options. 2012/01/22 version 1.0.0 Licence: Public Domain */
... again, thanks