Jump to content



Recommended Posts

This litte script creates a form and sets a gif image tiled in background...

I put an example gif but any works ok!!!

This is:

#include <GUIConstants.au3>
$gif=FileOpenDialog("Select a GIF file",@ScriptDir,"GIF files (*.gif)")
$tiles = _GUICreateWithTiledBackground($gif, 640, 400)
GUICtrlCreateLabel("Test Label:", 48, 72, 57, 17)
$Input1 = GUICtrlCreateInput("", 112, 72, 137, 21, -1, $WS_EX_CLIENTEDGE)
$Button1 = GUICtrlCreateButton("Test Button", 432, 312, 105, 33)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE

Func _GUICreateWithTiledBackground($sPic, $guiW, $guiH) ;$sPic MUST be Gif
    $GuiWH=GUICreate("Tiles Example", $guiW, $guiH)
    Local $tileW,$tileH
    _GetGifPixWidth_Height($sPic, $tileW, $tileH)
    Local $iTilesX = Round($guiW / $tileW)
    Local $iTilesY = Round($guiH / $tileH)
    Local $x = 0, $y = 0
    For $i = 0 To $iTilesX
        For $ii = 0 To $iTilesY
            GUICtrlCreatePic($sPic, $i*$tileW, $ii*$tileH, $tileW, $tileH)
            GUICtrlSetState(-1, $GUI_DISABLE)
    Return $GuiWH
EndFunc   ;==>_GUICreateWithTiledBackground

Func _GetGifPixWidth_Height($s_gif, ByRef $pwidth, ByRef $pheight) ;Thanks to gafrost
    If FileGetSize($s_gif) > 9 Then
        Local $sizes = FileRead($s_gif, 10)
        ConsoleWrite("Gif version: " & StringMid($sizes,1,6) & @LF)
        $pwidth = Asc(StringMid($sizes, 8, 1)) * 256 + Asc(StringMid($sizes, 7, 1))
        $pheight = Asc(StringMid($sizes, 10, 1)) * 256 + Asc(StringMid($sizes, 9, 1))
        ConsoleWrite($pwidth & " x " & $pheight & @LF)
EndFunc   ;==>_GetGifPixWidth_Height


Hasta la vista!

Some code is from others... I just take the pieces together... :whistle:

Special thanks to jpam and razerm


Edited by Ed_Maximized
Link to comment
Share on other sites

Usually a good idea to put the Header with the function from other peoples scripts

@gafrost: Sorry!!! :"> I've used your function so many times... this is the first time I don´t give you the credits!!! Corrected

Link to comment
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

  • Recently Browsing   0 members

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