Picture && Textbox Moving
Hello All Memebers How can i move a picturebox or textbox on a form in the running time. thanks alot for advice
Egyptian Man
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
1 Thing About Moving A Picture Inside A Picture Box Control
Hi there! I've a picture inside a picture box control, and when I click the command button, the picture should slide towards the left inside the picture box, meaning that the more it slides to the left, the lesser we'll see of the picture. The thing is : although my picture slides correctly, it never seems to stop even though when it's right coordinate has reached the left coordinate of the picture box! Help!!!!!!
Moving A Picture On Top Of Another Picture With A See-through Hole
Here's what I want to do
I have a Picturebox with a bitmap in it. The bitmap picture can be anything. I call this picBackground.
I have another Picturebox with a bitmap in it. This Picturebox is smaller than picBackground. The bitmap picture is a white circle in the middle with a black surrounding. I call this picHole
Now, when I mouse down on picHole I want to move it around and on top of picBackground. As it moves around I want the image from picBackground to show in the white circle only; but not through the black part of picHole.
If I release the mouse from picHole I want the black square with the see-through hole (picHole) to stay put still showing the under-neath image of picBackground showing in the white circle.
Now if I simply move the mouse around nothing changes.
If I return the mouse back to where the picHole was positioned when I released the mouse I want to do a mouse down and continue moving the picHole with the same results as above.
How can I acompolish this?
Now just thinking about it I somehow get the idea I will need a Picturebox to hold a square portion of the picBackground where the picHole is on top of. Let call this picSave. I will need another Picturebox which will contain a mask of picHole; that is to say, just the opposite where there is a black circle with white surrounding. Let's call this picMask.
I just do not know how to manipulate this.
Moving A Picture Box
Hi, I am a newbie programmer and do not know much about VB. I need to make a picture box (with an image of course) bounce off the left and right of my form. i.e. It moves left to right till it hits say... 4000 or the edge of the form and then moves from right to left till it hits the edge and continue that way.Any help would be greatly appreciated.
Moving Picture
What's wrong with this ?
The program moves a picture (a circle) from right to left.
Though when a move is made the old picture still remains on the screen.
I use this line to save the background:
Picture1.Picture = Form1.Picture
and I try to restore it with:
BitBlt Form1.hdc, intX - 30, 0, 47, 46, Picture1.hdc, 0, 0, SRCCOPY
Can someone tell me what I'm doing wrong ?
I've zipped the files and included them.
Moving A Picture?
I have bitblitted a picture on my form. Now I want to move the picture when a click on it and move the mouse.
I know the X, Y, length and heigth of the picture (they are stored in a variabel)
So I can see in the form_mousedown if I hit the picture. But I don't know how I can move it along with my mouse moves. For exemple, when I click on the picture and move the mouse 3 pixels to the right, the picture also has to move 3 pixels to the right.
Does anyone knows how to do that??
I hope you know what I mean
Wilbert
A Moving Picture?
I'm new to Visual Basic.
I have written a small game where a monkey falls down the screen and
you have to click it before it reaches the bottom. I used a picture box
with a picture of a monkey in it and made it fall by using a timer. I have
a problem now as the picture flickers as it goes down the screen. After
reading around I understand that my best bet is proberly using bitblt, but
I don't really understand the tutorials.
I need the picture to have a buttondown event and to movable.
I'm unsure about how I would do a buttondown event on the picture.
I guess I would move the picture by using variables for the position of
the picture. Is that correct?
And can I use an icon with bitblt or will i have to convert it to a bmp or
is there a better/simpilar way to move an icon/picture around the
screen?
Thanks for your time.
Moving A Picture Box
Hi - it's a simple question (famous last words)...
I have a (transparent) picture box that I want the user to be able to move by dragging with the mouse (sort of "on Mouse down, drag; on mouse up, stop dragging").
How do I do this?
Moving Picture Box
Well I've placed a picture box and would like it to vibrate in its place so i inserted a picture box and a timer , in the times code i placed this ,
The problem is the picture box goes to the right and never returns (lol)...
Code:
Private Sub Timer1_Timer()
Dim R As Integer
Dim move As Integer
R = Form1.ScaleWidth
Select Case move
Case 0
Picture1.Left = Picture1.Left + 10
If Picture1.Left = 100 Then
move = 1
End If
Case 1
Picture1.Left = Picture1.Left - 10
If Picture1.Left = 0 Then
move = 0
End If
End Select
End Sub
Moving Around In A Picture Box?
i have a picturebox where i will be loading pictures too big to fit in it... i have set up h and v scroll bars but am not sure how to use them to move through the picture
i dont want to use an imagebox's stretch property
Moving Picture.
--------------------------------------------------------------------------------
I'd like to make the acting picture on the form.
It is made by timer event handler , It will move to the right direction by 1 cm.
Can yall show me the brightest source and form design picture to me .
one cm by one cm to the right direction in 1 second.
starting point to ending point 1 cm to the right direction by loop. Like this detail.
It will automatically move to the right direction by 1 second by 1 cm.
Thanks a lot.
Please Reply to my asking...
Moving Picture
Ok i'm having a problem...I can't get this to slow down at all. I tried to use numbers less than one but it just locked up visual basic.
Private Sub cboWeapons_Click()
If cboWeapons.Text = "Fire Ball" Then
cboWeapons.Enabled = False
picFireBall.Left = 7680
picFireBall.Visible = True
Do While picFireBall.Left > 2520
picFireBall.Left = picFireBall.Left - 1
Loop
End If
End Sub
Also where would i go about telling it to turn visible = false again so it knows to make it invisible after the do while loop is done? Any help is appreciated.
VB 6 Moving Picture Help
Hi,
I am starting to create a space invader style game and for some reason when i click Run the userform doesn't show.
I am a novice to VB programming, so bear with me :P
vb6 Code:
Dim i As Integer
Dim PauseTime, Start
Dim hit As Boolean
Sub Frame1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Select Case KeyCode
Case vbKeyLeft
UserForm1.Moveleft
Case vbKeyRight
UserForm1.Moveright
Case vbKeySpace
UserForm1.shoot
End Select
DoEvents
End Sub
Sub Moveleft()
i = ship.Left - 10
If i > 0 Then
ship.Left = i
End If
End Sub
Sub Moveright()
i = ship.Left + 10
If i < 270 Then
ship.Left = i
End If
End Sub
Sub shoot()
bullet.Move (ship.Left + 11), (ship.Top - 4)
bullet.Visible = True
PauseTime = 1
Start = Timer
Do While Timer < Start + PauseTime
bullet.Top = bullet.Top - (1 / 5)
Frame1.Repaint
DoEvents
If bullet.Top < 0 Then
bullet.Visible = False
Exit Do
ElseIf bullet.Top = (invader1.Top + 13) And bullet.Left > (invader1.Left) Then
If bullet.Left < (invader1.Left + 20) Then
hit = True
bullet.Visible = False
invader1.Visible = False
MsgBox ("Hit")
Exit Do
End If
End If
Loop
End Sub
Sub Moveinvader()
invader1.Move 10, 10
Do While invader1.Left > 0
invader1.Left = invader1.Left + (1 / 10)
If invader1.Left > 300 Then
invader1.Left = invader1.Left - (1 / 10)
If invader1.Left < 0 Then
invader1.Left = invader1.Left + (1 / 10)
End If
End If
Frame1.Repaint
DoEvents
Loop
End Sub
Sub UserForm_Initialize()
UserForm1.DrawBuffer = 256000
UserForm1.Moveinvader
End Sub
If I remove the "Userform1.moveinvader" function it runs fine and I can move the ship and fire. It just won't run with the .moveinvader bit there.
Thanks,
Loader
Moving A Picture
On my form i have two stacks of six pictures boxes in two arrays. What i want is every 3 seconds if the two pictures boxes on top of the stacks dont have the same picture in them then it should randomly go through the two stacks and pick another two picture boxes to appear ontop of the stacks but if the two picture boxes do match and a button is pressed then something appears on a label but if the two picture boxes dont match and the button is pressed then something appears on another label.
I was told in an earlier post that i just had to move the pictures so how would i randomly move the pictures.
Thanks
Jamie
Moving Picture
I have a picture in a Image control and I'm constantly moving it from left to right from a Timer set to 10ms.
The picture is a gif image with a transparent background.
The problem I have is that each time the image is moving, it flashes. Is there a way to make it move clearly ?
Moving A Picture Box
How can I modify this code so that it will move the picture box from its current position to a place on the tile map where the right mouse button is clicked?
VB Code:
Option ExplicitDim LeftMouseXDim LeftMouseYDim PicX As IntegerDim PicY As IntegerDim ImageSelect As BooleanDim MouseClickOn As BooleanDim MouseClickOff As Boolean Private Sub Picture1_Click(Index As Integer)If ImageSelect = True ThenLeftMouseX = Picture1(Index).TopLeftMouseY = Picture1(Index).LeftPicX = Picture2.TopPicY = Picture2.LeftDoPicture2.Move Picture2.Left + 10Loop Until PicX = LeftMouseXEnd IfEnd Sub
The tile map is made from images set in an array(Index). I want the picture box to move to the upper right corner of the tile that is clicked.
thanks for an y help
Moving Picture
Does anyone have code that will move an obect (ie a button or picture ) accros a form edge to edge
Thanks
Moving A Picture
Hi, I am relatively new to visual basic and am trying to get an image to act like a slider. My goal is to have an image that the user can click on and then the image will move as the user moves the mouse. However, the picture flickers as the image moves. What could be the causes of this or the ways to fix it? In addition to the flicker the image does not move the same amount as the mouse. So the mouse cursor will not stay on top of the image as it moves.
Public moving As Boolean
Public AnchorX As Single
Public AnchorY As Single
Public MoveLeft As Single
Private Sub Image1_MouseDown(Index As Integer, Button As _
Integer, Shift As Integer, X As Single, Y As Single)
moving = True
AnchorX = X
MoveLeft = Image1(0).Left
End Sub
Private Sub Image1_MouseMove(Index As Integer, Button As _
Integer, Shift As Integer, X As Single, Y As Single)
Dim l As Single
Dim t As Single
If moving Then
l = MoveLeft + (X - AnchorX)
Image1(0).Move l
End If
End Sub
Private Sub Image1_MouseUp(Index As Integer, Button As _
Integer, Shift As Integer, X As Single, Y As Single)
moving = False
End Sub
Thanks in advance.
Moving Picture
can anyone tell me how do i create a moving picture
i have tried using the image.visible=true command but it didn't really work out as what i wanted(i have already put all the pictures of the dffrernt of the images on the form). and what are the commands used the keydown(vbkey).
Picture Box Moving
i have a picture box named picture1 inside a picture box named playf. i want the one on the inside to move where the person clicks. So if some clicks at the top right of the picture boxed named playf, then the picture box named picture1 moves there one space at a time. how do i do this?
A Picture Moving By Itself In A Form
when i s say this i mean i just want to find out how i can make a picture appear at the top and then slowly scroll down the form and then repeat the process as long as that form is there. i know it is something to do with a loop but i just can get it right
Moving Picture Animations BMP V JPG
Hi All,
My project has alot of moving picture animations, some of which use images with a resolution of 900 x 600. Generally they run fairly smoothly using a timer function, but something very strange happened. When I use BMP's as the sequence images, the animation is fast and smooth, but each image file is around 1.5MB. I changed all the images into jpg format which reduced the size to 200kb, but low and behold the animation was very slow even with the timer interval set to 10. Does this make any sense. Is there perhaps a better way of doing these animations. Any suggestions would be much appreicated.
Thanks
Moving Pictures In A Picture Box
Hi!
I've got a problem with moving pictures in VB.
My application has a picture box on the main form containing a background picture. Programm has to insert several pictures into that picture box . Position of these pictures (they are all alike, btw) depends of calculations, performed by the application. In the end something like a graph must appear where instead of graph points pictures must stand.
What method would real VB-gurus suggest for this?
I know, that plotting a graph with PSet method would be much easier but.. the design calls for picture objects.
Thanks for any ideas!
Moving A Picture Behind Cells
I have an application (Excel 2002) which we use to display and record process data from a test rig.
The data is transferred from our test equipment to excel through DDE, so that individual temperatures, pressures etc are displayed in individual cells.
We have made a graphic diagram of the process as a JPG file, and would like to have the temperatures and pressures appear in certain locations on the diagram.
Right now we have the picture set as the background (worksheet.setbackgroundPicture), but the picture does not size correctly when the screen size changes, i.e. zoom or other.
I can put the picture in the front and make a color transparent to allow me to see the cells behind it. However when I try to click on a cell, I select the picture instead.
Is there a way to move the picture behind the cell (in the z-order, so to speak) or some how disable the selection?.
One way of doing the cell is to click outside the picture and use the arrow keys to move to the right cell, but that is not intuitively correct.
Any comments or ideas would be appreciated.
thanks
Moving A Picture Back And Forth Using VB
I was trying to make an image I have move back and forth on the screen. It would move to a certain distance downwards and then begin to move back up wards.
I came up with this code:
Private Sub Timer1_Timer()
If picLogo.Top >= frmQuiz.Width - picLogo.Top Then
picLogo.Top = picLogo.Top - 20
Else: picLogo.Top = picLogo.Top + 20
End If
But, when it gets to a certain distance, it just stays still. Can you someone please help me?
Moving Picture Boxes
I am making a soccer shoot-out game and i want to move the soccerball (the Picture Box) to where the player selects eg. top right, top left, top centre, bottom right, bottom left, bottom centre. If someone could please help me with this code it would be much appreciated
Moving Objects Over A Picture
Has anyone any idea how to create a small app that lets you move objects around on a picture while keeping them all individual?
I am trying to create an app that lets you select from a series of small images and drag them onto a large image for positioning/sizing. Each small image should remain individual and resizeable until you click 'Apply' when they will become part of the large image.
Thanks, i dont know if its possible in vb without writing each line of code to do it or if theres a component that does it for you.
Cheers
Moving A Picture Box At Runtime
Probably really simple and I'm probably just being a prat for not being able to work out how to do it.
Basically, I have a number of picture boxes on a form. At the moment, I can resize them at runtime but now I need to be able to move them as well.
Any help is greatly appreciated. Any jeering comments are probably deserved
Thanks in advance
Moving A Picture With Mouse
Hey...........is it possible to move a picture around the form with the
mouse ?
I have a form with one picture on it........when I hold down the mouse I
would like the picture to follow the mouse until mouse is released and then
place the picture there.........can anyone tell me how with a short code
example ??
Moving Picture (Urgent)
I am Currently trying to make a game for a colledge project. In the game you have to catch a hazard sign that is moving about the form by clicking on it. I have hit a problem but. i can make the picture move by using the GoTo command to place it in different places around the form. This is far to fast adn the picture flashes and you cant really make it out.
Heres the code im using to move the picture:
DoEvents
LeftX = Int((9500 * Rnd) + 1)
TopY = Int((6500 * Rnd) + 1)
Image1.Left = LeftX
Image1.Top = TopY
GoTo 2
2
Refresh
GoTo 3
3
Refresh
GoTo 4
4
Refresh
GoTo 5
5
Refresh
GoTo 6
6
Refresh
GoTo 7
7
Refresh
GoTo 8
8
Refresh
GoTo 9
9
Refresh
GoTo 10
10
Refresh
GoTo 1
Is there anyother way of making this picture move smoothly around the form?
Edited by - Sc0tty on 2/28/2005 6:38:28 AM
Moving A Label To Another Picture Box
I have a label array, a textbox array and a picture box array.
the labels and textboxes are generally loaded on Picture(0).
I need to be able to load them on another Picture box.
I am able to do this with the textboxes using their hWnd.
Code:Public Declare Function SetParent Lib "user32" _
(ByVal hWndChild As Long, _
ByVal hWndNewParent As Long) As Long
So I load them and then I move them to te appropriate Picture box.
But labels don't have an hWnd. So I cant use that function.
Anyone who knows how I can move a label between Picture boxes?
Edited by - beki on 3/25/2004 12:49:11 AM
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...
Is There Any Event That's Sent When The Picture Box Is Moving?
Hi there! Is there any event send when the picture box is moving?
For example, I've a moving picture box when the user clicks on a command button. I want to pop up a message box when ever the coordinates of the picture box changes(the width & height is still the same), but there doesn't seem to be any event to handle this!
I can probably use a timer, but this is kinda inefficient u know,.......thanks a lot! :-)
Moving Picture Boxes
Does anybody know how to move a picture boxe across the screen within a visual basic form.
Wierd Results When Moving A Picture Box
I'm making a program, where when I'm holding down a mouse button while on a picture, if I move my mouse it moves the picture. However I'm getting really wierd results. I've got a Picture1 picture box. Here's the properties for it and the code:
Properties:
AutoRedraw=False
AutoSize=True
Appearance=flat
BorderStyle=None
Code:
Code:
Private bDown As Boolean
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
bDown = True
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If bDown = True Then
Picture1.Left = X
Picture1.Top = Y
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
bDown = False
End Sub
Using Picture Box As Container And Moving Contents
Dear all
If I draw a graphic inside a picture box I can rotate it etc using POINT and PSET with appropriate maths. What I would like to do is place another (actually several) picture box(es) inside the same original picture box and have them rotate using the same means but it doesn't work. Why is this? and have you any clues how I can get the 'inside' picture boxes to move inside the original box?
Thanks
Optom
Picture Loop From Top (Moving Starfield)
I have a neat picture of a starfield, but just slapping it on vb as a picture behind everything adds no action. I was wondering how I might be able to take this picture (called starfield) and make it loop itself and make itself drop down from the top of the form over and over and over without a break, to make it look like a starfield travelling downward?
Moving Multiple Picture Boxes - Lag?
On my form I have a control array of 239 picture boxes NOT being moved. Then I create 5 picture boxes of a new control array and move them with a timer with the interval set to 10. It moves fine, but when I load another 5 picture boxes totaling 10 the game starts to lag by the images starting to move slower then set to. The more I load and more the slower it keeps getting.
I am increasing the .top of all of the picture boxes by 25 every time the timer ticks with a 10 interval.
How can I prevent this 'lag'?
Moving Picture With Mouse Pointer
CIAO
I have inserted an image in my form.
I want to do such type of thing that whenever my mousepointer moves on the form the image moves.
I know the event should be Form_mousemove but what should be the coding for that
plus
the image always lies in the form
Thank You
Help! Moving Edited Picture To ImageBox
OK... I've been pulling my hair out trying to figure this out, so hopefully one of you VB experts can help... here's the deal:
I'm coding a football program. I am storing my sprites (GIF pictures) in 71 invisible picture boxes, and then loading them to image boxes when they are needed on the screen. I am using GIF graphics because I need a transparent background so the movement doesn't look stupid.
Now... to designate different teams in my football game, I obviously need different jersey colors. I need to have about 30-40 unique jerseys. In order to avoid creating 2000-3000 unique sprites just to have this many jerseys, I want to simply use replace color code on one set of sprites. And I have the replace color code working fine, I can swap all the red in a jersey for blue etc. etc. with no problem. But here is where I run into trouble:
After I replace the color red with the color blue in the invisible picture boxes, for ex. Picture1, I then need to move these edited graphics with blue jerseys to my imageboxes, for ex. Image1.
If I do image1.picture = picture1.image, I get the graphic with the blue jersey, but I lose all the transparency information - the background color of the picturebox is copied along with the sprite and put in the ImageBox. This looks stupid - my graphic is carrying a block around with him. If I do image1.picture = picture1.picture, I keep the transparency information from the picturebox but the replace color is lost (is goes back to the 'persistent' graphic with the red jersey, losing all editing).
So.. what can I do to get the edited graphic from one of my pictureboxes to an imagebox? Surely there is some way to let the .Image property account for transparency, isnt there - or is it stuck in bitmap format or something? Is there a way to make the .Picture property include changes made during runtime, like replacing a color? Or is there a way I can replace color within an image box, thus avoiding the problem altogether?
Any help is GREATLY appreciated, as it will save me 20-30 hours of sprite work. Thanks!
NOTE: can use either VB5 or VB6 for coding, if that makes a difference
Scrolling A Picture But Not Moving The Frame
Hi All,
I'm working on a little graphing program, and I want to be able to scroll the resulting graph within the picture frame. I don't seem to be able to see how to do this, although I'm sure it is right in front of me. I really have looked!
Thanks,
Jonathan
www.madlabs.info
Moving A Picture Box With Keys? *SOLVED*
Is it possible to move an image within a picturebox? I need to move it left and right.
If KeyCode = vbKeyLeft Then Image2.Left = Image2.Left - 1
If KeyCode = vbKeyRight Then Image2.Right = Image2.Right + 1
This is not working!!
Moving A Picture Box With Arrow Keys
I have a picturebox within a picturebox. I need to be able to move the picturebox that sits inside the other box with my arrow keys. The other tricky part to the problem is that I have a few of these that I need to move to I have to know which picturebox has focus.
PS. hope you understand what I am trying to say.
Moving A Small Picture With The Mouse
I have a small picture (picture1) on a form. I am looking to click and hold this picture with the left mouse button and move it to another location on my form. I would also like to have the coordinates of the picture in a text box change when I am moving the picture around. I can't seem to find any help with this... If anyone could help,, it would be greatly appreciated. Thanks, Justin. transam_00@sbcglobal.net
Moving A Picture Inside A Picturebox
Hi,
I am trying to set the position of a picture inside a picturebox with the
folowing code:
pctOutput.Picture = LoadPicture(App.Path & "picture.bmp", [Size],
[ColorDepth], [X], [Y])
I didn't know what to fill in at [Size] and [ColorDepth] so the result was:
pctOutput.Picture = LoadPicture(App.Path & "picture.bmp", (315) - (315),
1, x2, y2)
'(x2 and y2 are declared variables)
My problem is that the picture hasn't moved at all, it's still in the upper
left corner :(
Does anyone here know how to set the position of a picture inside a
picturebox?
Thanks for your help.
Chris
Moving Picture Boxes W/ Keyboard
is there a way to be able to move picture boxes using the keyboad? i.e picturebox1 moves up using the caps lock key, and down by using the shift key. picturbox2 moves up using the plus sign(the one all the way to the right of the keyboard no the one above the equal sign) and moves down by hitting the enter key(under the plus sign).thnx in advance for any help.
|