6 Replies - 3987 Views - Last Post: 03 May 2010 - 07:08 AM Rate Topic: -----

#1 gr33nb0y  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 01-May 10

moving image

Posted 01 May 2010 - 07:43 PM

How to move an image up, down, right, left while clicking the buttons?

Posted Image


Is that possible?

Thanks in advance

This post has been edited by gr33nb0y: 01 May 2010 - 08:47 PM

Is This A Good Question/Topic? 0
  • +

Replies To: moving image

#2 vb5prgrmr  Icon User is offline

  • D.I.C Lover

Reputation: 109
  • View blog
  • Posts: 1,016
  • Joined: 21-March 09

Re: moving image

Posted 01 May 2010 - 08:57 PM

If the image is contained within a control, then you would adjust the Left and Top Properties of the control. If the image is drawn, then you need to adjust the values you used to draw the image, which means you would have to clear current drawing methods and redraw the image with the new values...



Good Luck
Was This Post Helpful? 0
  • +
  • -

#3 gr33nb0y  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 01-May 10

Re: moving image

Posted 01 May 2010 - 09:07 PM

View Postvb5prgrmr, on 01 May 2010 - 07:57 PM, said:

If the image is contained within a control, then you would adjust the Left and Top Properties of the control. If the image is drawn, then you need to adjust the values you used to draw the image, which means you would have to clear current drawing methods and redraw the image with the new values...



Good Luck

'if i want the ball to go up when it is moving , can i make an event if i click up, etc. ?
Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: moving image

Posted 01 May 2010 - 09:36 PM

Sorry but we can not give you the entire code to solve your problem. We are here to assist in solving problems with code you have written, with any error messages you are getting or what isn't working the way that you expect it to, we would be more than happy to help you with those problems. If there is a topic that you don't understand we would be more than happy to help you with that as well. Make sure to post any code with in code tags like below.

:code:

Be sure to visit our tutorial and snippet areas or read the FAQS at the top of the forums. Also, take a moment to read the rules about posting topics.

Thank you for helping us to help you solve your problem.
Was This Post Helpful? 0
  • +
  • -

#5 vb5prgrmr  Icon User is offline

  • D.I.C Lover

Reputation: 109
  • View blog
  • Posts: 1,016
  • Joined: 21-March 09

Re: moving image

Posted 02 May 2010 - 09:34 AM

Well if those are command buttons over there on the right side, or image controls, or picture box controls, you can use the click event of those controls to determine the direction that the image moves. If they are not any type of control and that is just a graphic, the the control holding that graphic I'll bet has a click event that you can use. Actually, you would probably want to use the mouse down or up event for that as those events have the x and y of where you clicked...



Good Luck
Was This Post Helpful? 0
  • +
  • -

#6 gr33nb0y  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 01-May 10

Re: moving image

Posted 03 May 2010 - 06:01 AM

 Private Sub mnuStart_Click()
    Dim direct As Integer
    direct = Fix(4 * Rnd)
    Select Case direct
        Case 0: dx = -100
            dy = -100
        Case 1: dx = 100
            dy = -100
        Case 2: dx = 100
            dy = 100
        Case 3: dx = -100
            dy = 100
    End Select
    tmrBounce.Enabled = True
    mnuStart.Enabled = False
    mnuStop.Enabled = True
End 

Private Sub tmrBounce_Timer()
    Dim tempx As Integer, tempy As Integer
    
    tempx = x + dx
    If (tempx + imgBall.Width > imgBox.ScaleWidth) Or (tempx < 0) Then
        dx = -dx
        Beep
    End If
    x = x + dx
    tempy = y + dy
    If (tempy + shpBall.Height > imgBox.ScaleHeight) Or (tempy < 0) Then
        dy = -dy
        Beep
    End If
    y = y + dy
    shpBall.Move x, y
End Sub
 


I have the code to make it move random, but I want to make it move just up and down and right and left. How should I change
Was This Post Helpful? 0
  • +
  • -

#7 vb5prgrmr  Icon User is offline

  • D.I.C Lover

Reputation: 109
  • View blog
  • Posts: 1,016
  • Joined: 21-March 09

Re: moving image

Posted 03 May 2010 - 07:08 AM

Please reread my previous post carefully...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1