Image Moving On Keypress
2 questions.. # 1, is there a KeyAscii for the arrow up down right left keys??
and #2, when i make Image1.left = image1.left - 25 , it moves but it flashes. Thats very annoying and ugly, ive tried transparent and not transparent, it always flashes. is there a way so it moves without flashing???
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Moving IMages With KeyPress
Im new to vb, and im having some trouble getting an gif image to move up,down,left,right, caused by a keypress.
ive tried code like this in a form Key ascii sub thing,im trying to get a Link sprite to move around
If KeyAscii= vbKeyUp then
imgLink.Picture = LoadPicture (app.path & "linkup.gif")
imgLink.top = imglink.top + 100
End If
when i run it and hit up, nothing happens. I also used that code style to get him to move left, right, down. still nothing. any suggestions?
Moving An Object Via Keypress
Hello guys, i just wanna know what are the keycodes for the cursor keys? I want to use it in a program wherein i can move an object / shape via a keypress method... Thank you very much!!!!
Movement Of An Image Using Keypress
hi there im making a space invaders game and i want to know how i can make an image move left and right along the bottom of the form acording to what key i press, i want it to move left with the left arrow key and right with the right arrow key. i also need boundaries
do i need a keypress procedure or something
please help
Moving An Image To Move Another Image
Im creating my first small program for my assignment and ive done the design and code, just havign trouble with another part if anyone could help me please.
Here is my whole code first off.
Code:
Option Explicit
Private Sub cmdBat_Click()
While imgBall.Left < imgBatter.Left
'Moves the ball away from the bowler
imgBall.Left = imgBall.Left + 1
'Comment
DoEvents
Wend
'Comment
While imgBall.Left < imgBatter.Left
'Comment
imgBall.Top = imgBall.Top - 1
'Comment
imgBall.Left = imgBall.Left
' Allows the user to respond to another button
DoEvents
Wend
End Sub
Private Sub cmdBowl_Click()
While imgBall.Left < imgBowler.Left
' Moves the ball towards the batter
imgBall.Left = imgBall.Left - 1
' Allows the user to respond to another button
DoEvents
Wend
'Comment
While imgBall.Left < imgBowler.Left
'Comment
imgBall.Top = imgBall.Top + 1
'Comment
imgBall.Left = imgBall.Left
'Comment
DoEvents
Wend
End Sub
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdStart_Click()
imgBowler.Left = 8400
imgBowler.Top = 960
imgBatter.Left = 840
imgBatter.Top = 960
imgBall.Left = 7920
imgBall.Top = 2520
End Sub
What i need to do, as the ball gets to the bat for the bat to hit the ball and move it back where it came from. Ive done so far that the ball goes past the batter and when the bat button is pressed the ball comes back to the bat and goes back again.
I cant work out how to move the ball back when the ball is moving and the button is pressed. Im not advanced in programing either, ive been doing it for about a year
Here is an EXE of the program so far to demonstate
<link removed>
Using Keypress Event To Move An Image Around The Form
Code:
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Image1.Top = Image1.Top + 50
End If
End Sub
I used this code to make the image move down 50 each time I push the enter key (13) but I only used code 13 because its the only one I know... is there a code table or something so I can use other keys?
Image Moving
vb6.0
Hi,
id like to know how to move a picture inside an picture box without moving the box but only the picture inside it. like, i have a 2000x2000 picture in a 400x400 picture box and wat i want is for it to show inside it and then i move the picture to see differ parts of it while the picture box remains in the same place.
Thank you.
Seeing The Image While Moving It
How to move an Image (or a PictureBox) over a Form and see the image, not only its surrounding frame, during the move phase. Basically, my code looks as follows:
[vbtemp]
Private Xi As Single
Private Yi As Single
Private Sub Card_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Card(Index).Drag vbBeginDrag
Xi = X
Yi = Y
End If
End Sub
Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Source.Move X - Xi, Y - Yi
End Sub
Private Sub Card_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
Source.Move Source.Left + X - Xi, Source.Top + Y - Yi
End Sub
[/vbtemp]
The 'Card' is an Image (or a PictureBox) located in a control array. The code works fine, but I can't see the card face while I'm moving it.
Moving An Image
I tried borrowing the code from ?????'s pacman example
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'figure out where we WANT to go....
Select Case KeyCode
Case vbKeyLeft:
ShpTestShooter.Move -350
Case vbKeyRight:
ShpTestShooter.Move 350
End Select
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case vbKeyLeft:
ShpTestShooter.Move -350
Case vbKeyRight:
ShpTestShooter.Move 350
End Select
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft:
ShpTestShooter.Left = ShpTestShooter.Left - 350
Case vbKeyRight:
ShpTestShooter.Left = ShpTestShooter.Left + 350
End Select
End Sub
arrrrggggh!!
how did he managed to get his pacman working???
My program refused to respond to my pressed keys
which are arrow buttonws
Put a breakline, it absolutely refused to go there
Image Moving
How can you get a picture box or an image to move across the screen. I'm guessing you can use a timer, but am not quite sure how to set up the timer. What I have is... a for next loop in a sub called PlaneMove (I call that sub in GameLoop). So, in this sub, I set the image.visible = true, and then the for next loop is
For i = 1 to MAXPLANEX (MAXPLANEX is the end of the form to the right)
Picture.move i, Y (Y is an int(Rnd) formula to make the y coordinate a random number)
Image.move i, 0 (I don't know why, but I can't get the picture box to move across the screen without an image moving across the screen also, but if I just have an image it jitters, and has problems.)
Next i
So anyway, the result of the for next loop is that it works, the Picture Box of an image of a plane moves across the screen very smoothly, but there is one problem. The whole loop has to go through before any other action can be done, and in this case in this game, Player 1 is a tank that has to shoot the plane, and it should be able to move left and right, and up and down, with the max y coordinate set at an integer so that it can't pass that integer. The problem is, the plane has to move through the entire screen, and only after it passes, will the tank move to the cursor position, and Player 1 can't shoot at all, because as soon as the plane goes through the loop and gets to the end of the screen, and once the new tank picture is drawn at the tank coordinates, the planeloop starts again, and therefore there is no time for the ball to shoot out and move. I'm guessing that with a timer, the plane can move through the screen, and Player 1 can do all of the other actions without any problem, but I just can't figure out an algorythm for the timer, so I'm just basically stuck in an everlasting loop... both in the game and in the code... any suggestions?
Moving A Image
here is my code:
Private Sub Timer1_Timer()
imgshield.Move Left - 100, Top + 1000
End Sub
i've placed my code in the timer and form coding areas but it still won't work... why won't it... I want it to move constantly I.E.: like this simple little "."
I want it to go like this:
. . . . . . . .
I want it to be constantly moving until I tell it to stop
P.S. my interval's set at 1000
Moving Image
anyone have a code snipplet for that I could place in a timer to make an image move (right to left) accross my form? thanks in advance!
Moving Image (gif)
How can I add a moving gif on my form?
when I do it with a picture box or image it wont won't move.
can anyone tell me how I can do this?
//golles
Moving An Image
Is there a way where I can drag an image anywhere i want on a forum and when i let go the image will stay there?
Moving Image
I want to devolop
a project in which i want to gif images they are moving means animated
but when i put them on label or imge control
they become constant means not moving how can i use the please give some
sugestion
Thanks
Moving A Image
How can i move an image left and right???I would imagine its simple but i suck at vb well i will apreciate the help ty!
Image Moving
I have an image control on a form, and I'm trying to get it to move.
I want the user to be able to either click/drag it to anywhere on the form, but can't get the right event/code combination. Anybody know how to move an image during run-time?
Thanx.
Moving An Image
hello all,
i m trying to drag an image from a specific place on the form,
and drop it on another .
how can i do that?
tnx
LirLir
Moving An Image Everywhere
can someone please help me i need to know how to move an image in all directions randomly such as right left up diagonally ect (RANDOMLY) please
Moving Image So It Goes Everywhere
i need it so when i press go ..
the image will move randomly everywhere
such as a bird.. so when i press go the bird will fly down up left right diagonally and it will do it randomly
PLEASE HELP ME
Moving Image Help
Hi everybody!
can anyone tell me agood way of making an image float randomly around the screen? i've tried 'do until ' and 'if then' without getting the results I want.
Thanks in advance for any suggestions.
Moving An Image
Thanks to the guy who helped me move the image around the screen by using the keys but i have another problem. How do i make it so that when the user presses the keyboards left arrow, the image moves left but changes to another image. e.g.
i want to move the elephant image left
when i press left i want to move the image but change the image to one that is of an elephant facing left
how do i do this with al the arrow keys?
Moving Image W/ Mouse
I wanted to have an image move according to the mouse cursor. I've managed to do that with a mousemove procedure on the form. However, the image moves fine on the right side of the screen, but the image doesn't move so smooth on the left side. I'm not sure why there would be a difference, and I cannot change the effect.
Moving Image- Flashes
Hi,
I've got a very simple program, where a image in VB moves around the screen. To get it to move smoothly, i've put a timer on at 1ms, and it moves 1 pixel every ms. It works great.
However, the image "flashes" as it moves- black lines appear down it- like watching a TV screen through a camera. I've tried changing it to 10ms, 10 pixels, etc, but that doesn't really help much, since it is jerky.
Moving Image Too Fast...
Im working on a game that sets a image's position every 500
milaseconds, it works fine just looks well.... dumb... it shows the image move over then down kinda like streaking it to its position, I think bitblit will fix this but id rather not get into all that if there is an easyer way and yes it is very inportent that it sets the position every 500 milaseconds
Image Loading/moving
I was wondering if there is a way to load or move an image from a different form.
For example, if I have a picture in Form2.frm and I want to be able to display that image in Form1.frm at different times during the program, what would I do? I want to do this so that I can just store all my pictures in a form separate from my game and just call the images whenever needed.
Any help is appreciated.
Thanks.
Moving An Image With The Mouse
hey all, just wondering if anyone could point me in the direction of moving an image by clicking on it, and while holding the mouse button down and moving it in any direction, how to change the properties of the image(in this case, the .left, or .top properties)
Thanks in advance.
Making A Moving Image Go The Other Way?
Hey, Ive got an image moving around on my screen using option buttons, (up down left right) and I want, when it gets to a certain point, to go the other way. So say up is selected and it gets to y 3180 I want it to start going down. Ive had a go at the coding on the 5th line but it doesnt work, the other 4 do though. Can anyone help please? thanks
Private Sub Timer_Timer()
Dim original As Single
If OptDown.Value = True Then
ImgCross.Top = ImgCross.Top + 50
End If
If OptUp.Value = True Then
ImgCross.Top = ImgCross.Top - 50
End If
If OptLeft.Value = True Then
ImgCross.Left = ImgCross.Left - 50
End If
If OptRight.Value = True Then
ImgCross.Left = ImgCross.Left + 50
End If
If ImgCross.Top = 3180 Then
OptUp.Value = False
ImgCross.Top = ImgCross.Top - 50
End If
End Sub
Label In A Moving Image
is there any way to put a label or text inside a moving image so it contains some text in the center even when moving? This text will randomly changes everytime a certain event triggers
or I have to use the frame thing??
Moving An Image Up On Click
Im making a helicopter type game, and i want the helicopter to rise when i click the left button on the mouse. Also, i would like the helicopter to fall when the left button on the mouse isnt being clicked. My image name is helionclick. Im using vb 6.
Moving Image On Vb Form
hi all,
i want to add a image on vb form but not a static image .image like..
example: when we copy a folder and then paste somewhere moving
image of copying process.
anybody can help me.
thanks ,
abhishek mishra
Moving The The Form With Image??
i dont undersatnd realy how to do it
i took off the border (purpusly) i cant spell
Code:
Private Sub imgtop_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
frmmain.Top = Y
frmmain.Left = X
End If
End Sub
this is what i did, it moves but its so glitchy its jumps all over
plz help
Getting A Moving Image To Reverse Itself
Hey, you guys were really helpful last time, but alas I'm stuck again. I've got an image (ImgCross) moving around a screen with check boxes, but I want it, when it gets to a certain coordinate to go the other way. Any ideas? Thanks
The first four lines work fine but the bottom line doesn't do anything
If OptDown.Value = True Then
ImgCross.Top = ImgCross.Top + 50
End If
If OptUp.Value = True Then
ImgCross.Top = ImgCross.Top - 50
End If
If OptLeft.Value = True Then
ImgCross.Left = ImgCross.Left - 50
End If
If OptRight.Value = True Then
ImgCross.Left = ImgCross.Left + 50
End If
If ImgCross.Top = 1800 Then
OptUp.Value = False
ImgCross.Top = ImgCross.Top - 50
End If
Moving And Image W/ The Mouse.
Hi, I am working on a simple board game. When the player moves a piece, an image box appears (that moves with the mouse), the picturebox containting the board is redrawn wihout that piece, and it is moved to the new spot and the "dummy" piece dissapears and the board is redraw again with the new move. My only problem is: the pieces are round, and the image box that moves is square. When you move the piece, you can see the square border. What can I do about this?
Moving An Image With The Mouse.
Hi. I am creating a Vscroll OCX and i have everything finished excpet for moving the slider bar with the mouse when it is clicked on. Currently i am using GetCursorPos to try and move it.. Which it does move but depending on where the form ison the screen it moves differently.
What is the best way togo about something like this?
THe code i have so far is
VB Code:
Public Declare Function GetCursorPos Lib "user32.dll" (lpPoint As POINT_TYPE) As Long Type POINT_TYPE X As Long Y As LongEnd Type Private Sub imgSLIDER_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 ThenGetCursorPos COORD imgSLIDER.Top = COORD.Y * Screen.TwipsPerPixelY - 2200 End If End Sub
The -2200is just and arbitrary number. IT has no meaning. i'm just trying to figure this out.
I have attached a pic of the control to give you an idea of what it looks like.
Thanks alot for any help!
Moving An Image In All Directions
i was wondering how to make a image move around in all directions such as it moves right, then left, then up, then top right diagonally, then down ect
also how to randomise it
Help!! Moving An Image On The Screen
I am wanting to do it so when someone clicks on and image they can move it any where on the screen,and when they release the button the picture stays in that location...
Moving An Image In A Picture Box
Hi,
I'm writing a basic mapping type application in vb6. Within a picture box control I use simple drawing commands to create lines, circles,points etc. I have a toolbar with buttons to pan, zoom, scroll the display etc.
I now wish to enhance the viewing functions by introducing a 'hand' where the user clicks anywhere in the picture box, and drags the complete current image in any direction. On the MouseUp event the plot is redrawn at the new location.
Whats the best way to smoothly move the image? I understand that I'd have to capture a bitmap of the current view, and move this around keeping track of the screen coordinates and preserving my white background screen, but have no idea how to do this. I'm told this involves "blitting".
Any ideas?
Thanks...
Controlling A Moving Image Box - HOW??
Greetings all..........
thsi is probably sooooooooo simple that i will feel like a goose when the answer arrives.
situation. I am a basic to intermediate user of VB. Am teaching students at the moment the principals of conditional looping and using timer controls.
interface: have a single image box that we get moving by using
imgcar.left =imgcar.left+50
with every tick / interval of a timer control.
Students (and myself want to know and understand HOW we can stop the image when its right edge touchs the right sid eof the form.
We all thought that this would work fine
if form1.left=imgcar.left then
timer1.enabled=false
end if
.but it doesnt!!!!! Image just keeps speeding off into infinity.
We dont get it!!!! Do we have to break in to the existing process or something??????
they really want to get in to creating simple pacman type games interface but realy need to understand how to make these images stop moving in a direction and change to a different direction.
Has anyone got a solution for us.
Thanks
Moving And Renaming Image Files
How would I take an image file from the cd that my program runs on then rename it and move it to a directory on the hard drive?
Disable Moving Of Image In Listview???
I use ListView in Microsoft Windows Common Controls 6.0 (SP6). I can add image to fill background but when i scroll-down, the image is moved!
I want image not to move. How i have to do?
pls help!
Thanks
Moving Image Inside PictureBox
I want to move a image loaded in the picture on mouse movement. Like it happens in acrobat reader. I am trying to do it with a single picturebox. Have searched the forum completely for this buyt couldnt find the method which would let me move the image with out using two picture boxes ie... without using one picture box inside another one ....
thanks in advance..
Pls check ...
Moving A Single Image From One Form To Another
Hi,
i wonder if anybody can help me.
My Problem is as follows:
I have two forms. The first form is full screen size and the second form fills half of the screen at the top. On the second form i have an Image, the first form is blank. i want to move the image by clicking on it with the mouse and moving/drag it on to the first form is this possible? im not sure it is.
Another way would be to have identical Images on both forms but have the Image on the first form hidden. So when i drag the image from the second form to the edge it will become hidden and at the same time the image on the first form will appear still stuck to the end of the mouse giving the impression of ther only being one image. Would this work and if so what would the code be? Or is ther an easier way of doing it?
Thank for your help!
Moving An Image In The PictureBox (RESOLVED)
Hi there,
I'm trying to make a button that enables to move an image in a picture box.
For example when I click and drag the mouse to left the program makes the picture in the picture box move "a bit" (to be defined) left...
Is it possible? Any input is apreciated!
Thanks in advance
|