Jump to content
Sign in to follow this  
OminousIdol

Moving a Picutre?

Recommended Posts

OminousIdol

I was trying to move a picture up/down on a GUI... but I cant get the picture to move?

#include <GUIConstants.au3>

$cX = 0
$cY = 0

HotKeySet("{Up}", "Up")
HotKeySet("{Down}", "Down")

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

GUICtrlCreatePic("img1.jpg", $cX, $cY, 50, 50)

GUISetState()

While 1
    
    $gMsg = GUIGetMsg()
    
WEnd

Func Up()

$cY = $cY - 5

EndFunc

Func Down()
    
$cX = $cX + 5


EndFunc

This is what I tired to use to make the image move...

Thank You

Share this post


Link to post
Share on other sites
Valuater

#include <GUIConstants.au3>

Dim $cX = 0
Dim $cY = 0

$image = "C:\Temp\test.jpg"

HotKeySet("{F8}", "Up")
HotKeySet("{F9}", "Down")

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

$pic = GUICtrlCreatePic($image, $cX, $cY, 50, 50)

GUISetState()

While 1
    
    $gMsg = GUIGetMsg()
    
WEnd

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

Func Down()
    
    $cY = $cY + 5
    GUICtrlSetPos($pic, $cX, $cY, 50, 50)
    
EndFunc  ;==>Down

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
OminousIdol

GUICtrlSetPos, guess I missed that one hehe, it works perfect, moves up and down but how come when it moves, the image flickers a little bit? Anyway to fix this?

I even tired to use a label but it still flickers when I move it around, does it have somtthing to do with the GUI?

Thanks!

Edited by OminousIdol

Share this post


Link to post
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
Sign in to follow this  

×