Jump to content

Hello, im a new learner in Auto It, please help to show image


Recommended Posts

hello all, i have a problem and hope somebody can help me, im new in Auto It, i make 3 button, the first one, i like to show a message in mess box, and already ok, but the other buttons, i like to show picture in mess box too, or a pop up picture, so after ok, the program doesnt exit, but it failed ... need a light, thanx :)) sorry if the question so newbie ... THANX BE4

MYFUNC()

Func MYFUNC()

$font = "Comic Sans MS"

GUICreate("APLIKASI XXX ",800,600)

GUICtrlCreateLabel("BLA BLA BLA", 400,5,210,30)

GUICtrlSetFont(-1, 15, 500, 4, $font)

GUICtrlSetBkColor(-1, 0x00ff00)

$A = GUICtrlCreateButton("STRT", 330, 40, 70,20)

$B = GUICtrlCreateButton("B", 330, 70, 70,20)

$C = GUICtrlCreateButton("C", 430, 70, 70,20)

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $A

MsgBox(8192, "Box Info", "MESSAGE FOR REMIND THE TASK" )

Case $msg = $B

GUICtrlCreatePic((@ScriptDir & '\TIGER.JPG'))

Case $msg = $C

FileOpen(@ScriptDir & '\TIGER.JPG')

EndSelect

WEnd

EndFunc ;==>Example

post-69340-0-57690900-1326823409_thumb.j

Link to comment
Share on other sites

Add this line before GUISetState()

$Pic1 = GUICtrlCreatePic("tiger.jpg", 144, 104, 516, 480)

Also, the picture is too large for your GUI. You would benefit from resizing it and inserting it as it's actual size.

Edited by sleepydvdr

#include <ByteMe.au3>

Link to comment
Share on other sites

thanx for your input, yes with that the pic will show, but what if i want the pic show after we click the button 'B' or 'C' and after that it can hide, like pop up? any idea .... because i like to make many buttons that if u click can show different pic .... THANX again ... waiting for enlightment ...

Link to comment
Share on other sites

Below is an example that works for the "B" button:

#include <guiconstants.au3>

MYFUNC()
Func MYFUNC()

    $font = "Comic Sans MS"
    GUICreate("APLIKASI XXX ", 800, 600)
    GUICtrlCreateLabel("BLA BLA BLA", 400, 5, 210, 30)
    GUICtrlSetFont(-1, 15, 500, 4, $font)
    GUICtrlSetBkColor(-1, 0x00ff00)
    $A = GUICtrlCreateButton("STRT", 330, 40, 70, 20)

    $B = GUICtrlCreateButton("B", 330, 70, 70, 20)
    $C = GUICtrlCreateButton("C", 430, 70, 70, 20)

    GUISetState()

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $A
                MsgBox(8192, "Box Info", "MESSAGE FOR REMIND THE TASK")
            Case $msg = $B
                _ShowPicture()
            Case $msg = $C
                FileOpen(@ScriptDir & 'TIGER.JPG')

        EndSelect
    WEnd
EndFunc   ;==>MYFUNC

Func _ShowPicture()
    $gui2 = GUICreate("Form1", 553, 573)
    $Pic1 = GUICtrlCreatePic("tiger.jpg", 0, 0, 550, 570)
    GUISetState(@SW_SHOW)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($gui2)
                ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>_ShowPicture

Edit: The function you are looking for on the "C" button is ShellExecute.

Edited by sleepydvdr

#include <ByteMe.au3>

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
 Share

  • Recently Browsing   0 members

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