Created
May 29, 2015 05:38
-
-
Save tmplinshi/e4ebc6173e5fcf9e5691 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Img = http://www.animatedgif.net/cartoons/A_5odie_e0.gif | |
| Img2 = http://www.animatedgif.net/cartoons/anime_hero2_e0.gif | |
| Gui New, +HwndhGUI | |
| gif1 := AnimatedGif( hGUI, Img, 50, 50, 200, 200,, "MyGif", "myGif_" ) | |
| gif2 := AnimatedGif( hGUI, Img2, 300, 50, 292, 167, "White", "MyGif2", myGif2 ) | |
| Gui Show, center | |
| return | |
| GuiClose: | |
| exitapp | |
| AnimatedGif( ByRef guiHwnd, Image, X, Y, W, H, BackgroundColor:="system", Id:="AnimatedGif", eventHandler:="" ) { | |
| if BackgroundColor in system | |
| { | |
| A_FI := A_FormatInteger | |
| SetFormat Integer, Hex | |
| BGR := DllCall( "GetSysColor", Int, 15 ) + 0x1000000 | |
| SetFormat Integer, %A_FI% | |
| StringMid R, BGR, 8, 2 | |
| StringMid G, BGR, 6, 2 | |
| StringMid B, BGR, 4, 2 | |
| BackgroundColor := R G B | |
| StringUpper BackgroundColor, BackgroundColor | |
| BackgroundColor := "#" BackgroundColor | |
| } | |
| Gui %guiHwnd%:Add, ActiveX, x%X% y%Y% w%W% h%H% +HwndGifHwnd, MSHTML: | |
| GuiControlGet HtmlObj, %guiHwnd%:, %GifHwnd% | |
| HtmlObj.parentWindow.execScript( "document.oncontextmenu = function(){return false;}" ) | |
| HtmlObj.Body.style.BackgroundColor := BackgroundColor | |
| HtmlObj.Body.style.margin := 0 | |
| HtmlObj.Body.style.padding := 0 | |
| out := HtmlObj.createElement( "img" ) | |
| out.id := Id | |
| out.src := Image | |
| out.style.position := "absolute" | |
| out.style.left := 0 | |
| out.style.top := 0 | |
| out.style.width := "100%" | |
| out.style.height := "100%" | |
| out.style.minWidth := "100%" | |
| out.style.minHeight := "100%" | |
| out.style.visibility := "visible" | |
| HtmlObj.Body.appendChild( out ) | |
| if eventHandler | |
| ComObjConnect( out, eventHandler ) | |
| return out | |
| } | |
| myGif_OnClick( thisGif ) { | |
| ToolTip % "you clicked " thisGif.Id | |
| return | |
| } | |
| class myGif2 | |
| { | |
| OnClick( thisGif ) { | |
| ToolTip % "you clicked " thisGif.Id | |
| return | |
| } | |
| OnMouseDown( thisGif ) { | |
| if GetKeyState( "LButton", "P" ) | |
| ToolTip left mouse button down | |
| if GetKeyState( "RButton", "P" ) | |
| ToolTip right mouse button down | |
| return | |
| } | |
| OnMouseUp( thisGif ) { | |
| ToolTip mouse button released | |
| return | |
| } | |
| OnMouseOver( thisGif ) { | |
| ToolTip you are hovering | |
| return | |
| } | |
| OnMouseOut( thisGif ) { | |
| ToolTip you are no longer hovering | |
| return | |
| } | |
| OnDblClick( thisGif ) { | |
| ToolTip % "you double clicked " thisGif.Id | |
| return | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment