Jump to content

Moving a Image?


Recommended Posts

Hi, wrote a script to allow the Arrow Keys to move around a image... but it the flickers, grey background of the GUI will show through or random black lines will appear in the Image when it is being moved... I have no clue why its doing that and was wondering on how to fix it?

This is the code I am using...

#include <GUIConstants.au3>

Dim $cX = 0
Dim $cY = 0

$image = "img1.jpg"

HotKeySet("{UP}", "Up")
HotKeySet("{Down}", "Down")
HotKeySet("{Right}", "Right")
HotKeySet("{Left}", "Left")

GUICreate("test", 800, 600, 0, 0)

$pic = GUICtrlCreateLabel("", $cX, $cY, 60, 60)
GUICtrlSetBkColor($pic, 0x000000)

GUISetState()

While 1
    
    $gMsg = GUIGetMsg()
    If $gMsg = $GUI_EVENT_CLOSE Then ExitLoop

WEnd

Func Up()
    $cY = $cY - 10
    GUICtrlSetPos($pic, $cX, $cY)
EndFunc ;==>Up

Func Down()
    $cY = $cY + 10
    GUICtrlSetPos($pic, $cX, $cY)
    GUICtrlSetResizing($pic, $GUI_DOCKSIZE)
EndFunc ;==>Down

Func Right()
    $cX = $cX + 10
    GUICtrlSetPos($pic, $cX, $cY)
EndFunc ;==>Down

Func Left()
    $cX = $cX - 10
    GUICtrlSetPos($pic, $cX, $cY)
EndFunc ;==>Down

Thank You

Link to comment
Share on other sites

I don't know if you're senile or anything, but there is seriously no need to create

another topic when you already got an identical one. Just post in that one !

Just incase you infact are senile here is the link to to other topic.

Link to comment
Share on other sites

Ok, but I wouldn't call "v3 Support" the wrong forum, since it it is AutoIt v3 you're

using, and you're also in the need for support. "v3 GUI" is an old forum and if I

remember correctly it was created at the time when AutoIt didn't have the GUI-

functions, but instead this forum was to be used for the special version of AutoIt

that Larry made, named AutoIt-GUI (or something like that).

Of course you couldn't have known that, but it's not needed to create another

topic just to get it in the right forum either. The moderators would most likely

have moved your first topic anyway :D

Link to comment
Share on other sites

@OminousIdol:

I believe what Icekirby1 was trying to say is something similar to example 2 of GUICtrlCreatePic in the help file. Take a look at it, it does the same stuff you're trying to make and no flickering takes place.

Hope this helps.

IVAN

Edited by ivan
Link to comment
Share on other sites

Use controlmove() it doesn't produce flickering

F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]
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...