WHO REMEMBER this old window
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
WHO REMEMBER this old window
In effect i need to simulate the animation of the movement of withe icon from x,y to xx,yy, just one cicle.
start from x,y to xx,yy
note:
dont consider the dir icon and trash icon
start from x,y to xx,yy
note:
dont consider the dir icon and trash icon
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78626
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: WHO REMEMBER this old window
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
Re: WHO REMEMBER this old window
tks.HansV wrote: ↑25 Feb 2022, 11:30Perhaps you can use the video at Windows folder animation.
Otherwise: Move to Trash
but i need to via vb6 code, not with animation avi
-
- Administrator
- Posts: 78626
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
Re: WHO REMEMBER this old window
googling...
Here an example, but the picture run as randomized movement and the cycle is infinity...
I need to move only one time the icon from x, y to xx,yy
Code: Select all
Option Explicit
Private Const mSpeed As Single = 5
Private Sub Form_Load()
With Picture1
.AutoSize = True
.BorderStyle = 0
.BackColor = vbWhite
.Picture = Me.Icon
End With
Timer1.Interval = 1
Timer1.Enabled = True
Me.ScaleMode = vbPixels
Picture1.ScaleMode = vbPixels
End Sub
Private Sub Timer1_Timer()
Static GoingLeft As Boolean, GoingUp As Boolean
Dim NewX As Single, NewY As Single
With Picture1
If GoingLeft Then
If .Left - mSpeed <= 0 Then
NewX = .Left
GoingLeft = False
Else
NewX = .Left - mSpeed
End If
Else
If .Left + .ScaleWidth + mSpeed >= Me.ScaleWidth Then
NewX = Me.ScaleWidth - .ScaleWidth
GoingLeft = True
Else
NewX = .Left + mSpeed
End If
End If
If GoingUp Then
If .Top - mSpeed < 0 Then
NewY = .Top
GoingUp = False
Else
NewY = .Top - mSpeed
End If
Else
If .Top + .ScaleHeight + mSpeed > Me.ScaleHeight Then
NewY = Me.ScaleHeight - .ScaleHeight
GoingUp = True
Else
NewY = .Top + mSpeed
End If
End If
.Move NewX, NewY
End With
End Sub
-
- Administrator
- Posts: 78626
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: WHO REMEMBER this old window
See if this works. It is not the full solution, just a test. Form_Load is as above.
Code: Select all
Private Sub Timer1_Timer()
With Picture1
If .Left + .ScaleWidth + mSpeed >= Me.ScaleWidth Then
Timer1.Enabled = False
Else
.Move .Left + mSpeed, .Top
End If
End With
End Sub
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 564
- Joined: 27 Jun 2021, 10:46
Re: WHO REMEMBER this old window
Just a pedantic point:
>but i need to via vb6 code, not with animation avi
The animation you used as an example is indeed an AVI - and one that is included with VB6 to be used by the VB6 animation control (this being the same AVI linked to by Hans), e.g (assuming a form with a command button and an animation control):
>but i need to via vb6 code, not with animation avi
The animation you used as an example is indeed an AVI - and one that is included with VB6 to be used by the VB6 animation control (this being the same AVI linked to by Hans), e.g (assuming a form with a command button and an animation control):
Code: Select all
Option Explicit
Private Sub Command1_Click()
With Animation1
.AutoPlay = True
.Open "C:\Program Files\Microsoft Visual Studio\Common\Graphics\Videos\filedel.avi"
End With
End Sub
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
Re: WHO REMEMBER this old window
bro the code work perfect!HansV wrote: ↑25 Feb 2022, 12:49See if this works. It is not the full solution, just a test. Form_Load is as above.
Code: Select all
Private Sub Timer1_Timer() With Picture1 If .Left + .ScaleWidth + mSpeed >= Me.ScaleWidth Then Timer1.Enabled = False Else .Move .Left + mSpeed, .Top End If End With End Sub
but now i need to set the coordinate from the start and to the and in a form. see image for example.
choice you the start x,y and and xx,yy in form
note:
I had no doubts about your abilities!
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78626
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: WHO REMEMBER this old window
Try this. Change xSpeed, x1, y1, x2 and y2 as you prefer.
Code: Select all
Const xSpeed As Single = 5
Dim ySpeed As Single
' Start Position
Const x1 As Single = 20, y1 As Single = 25
' End position
Const x2 As Single = 200, y2 As Single = 100
Private Sub Form_Load()
Me.ScaleMode = vbPixels
With Picture1
.ScaleMode = vbPixels
.AutoSize = True
.BorderStyle = 0
.BackColor = vbWhite
.Picture = Me.Icon
' Set the start position
.Left = x1
.Top = x2
End With
With Timer1
.Interval = 1
.Enabled = True
End With
ySpeed = (y2 - y1) / (x2 - x1) * xSpeed
End Sub
Private Sub Timer1_Timer()
With Picture1
If .Left + xSpeed > x2 Then
Timer1.Enabled = False
Else
.Move .Left + xSpeed, .Top + ySpeed
End If
End With
End Sub
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
Re: WHO REMEMBER this old window
I Can assign to:.Picture = Me.Icon a icon from imagelist?HansV wrote: ↑25 Feb 2022, 14:52Try this. Change xSpeed, x1, y1, x2 and y2 as you prefer.
Code: Select all
Const xSpeed As Single = 5 Dim ySpeed As Single ' Start Position Const x1 As Single = 20, y1 As Single = 25 ' End position Const x2 As Single = 200, y2 As Single = 100 Private Sub Form_Load() Me.ScaleMode = vbPixels With Picture1 .ScaleMode = vbPixels .AutoSize = True .BorderStyle = 0 .BackColor = vbWhite .Picture = Me.Icon ' Set the start position .Left = x1 .Top = x2 End With With Timer1 .Interval = 1 .Enabled = True End With ySpeed = (y2 - y1) / (x2 - x1) * xSpeed End Sub Private Sub Timer1_Timer() With Picture1 If .Left + xSpeed > x2 Then Timer1.Enabled = False Else .Move .Left + xSpeed, .Top + ySpeed End If End With End Sub
Note:
the code work like a charm
-
- 4StarLounger
- Posts: 564
- Joined: 27 Jun 2021, 10:46
Re: WHO REMEMBER this old window
> .Interval = 1
No real point, system clock doesn't tick that fast ...
No real point, system clock doesn't tick that fast ...
-
- Administrator
- Posts: 78626
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: WHO REMEMBER this old window
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
Re: WHO REMEMBER this old window
Tks bro.HansV wrote: ↑25 Feb 2022, 19:38For example:
Code: Select all
Me.Image1.Picture = Me.ImageList1.ListImages(1).Picture
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
Re: WHO REMEMBER this old window
Problem...HansV wrote: ↑25 Feb 2022, 19:38For example:
Code: Select all
Me.Image1.Picture = Me.ImageList1.ListImages(1).Picture
i need to start picture in the area of the right listview and run the animation to the left listview
I have draw in right listview the picture, but i dont see! i have set the picture also to bring to the front, but always i dont see...
peraph i need to use other picture controll?
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78626
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: WHO REMEMBER this old window
I'm sorry, I cannot help you with this. Perhaps Speakeasy will have a suggestion.
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
Re: WHO REMEMBER this old window
Resolved with picturebox (named me.pictlitview)
actually i need to animatuion path only in orizhontal from start postion in left listview to the and in right listview position
On mouse move cursor have start position
x= 4935 y=1320
On mouse move cursor have end position
x=4110 y=1155
the picturebox start to the default is Left=10680 Top=3480 and to end position is Left=20160 Top=3480
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78626
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: WHO REMEMBER this old window
Just use the x-coordinate of the mouse then, and supply your own y-coordinate.
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 564
- Joined: 27 Jun 2021, 10:46
Re: WHO REMEMBER this old window
By the way, the VB6 documentation is key here:
(As you have discovered, this makes simple animation across an existing form a pain in the neck - but to be fair, I don't think easy animation of a form was a design goal of the classic VB forms engine.)
Your most recent solution works because the Picturebox is, perhaps a little confusingly, NOT a graphical control, and so sits in the front layer, and thus can be set above a listview.
Note, however, that a picturebox is not transparent, so you cannot see through it to the layers underneath, which means it will not display icons properly. This probably doesn't matter in your case.
and, most importantlyThree graphical layers are associated with forms and containers. The back layer is the drawing space where the results of the graphics methods are displayed. Next is the middle layer where graphical objects and Label controls are displayed. The front layer is where all nongraphical controls like CommandButton, CheckBox, or ListBox are displayed. Anything contained in a layer closer to the front covers anything contained in the layer(s) behind it
The image control is a graphical control and lives in the middle layer, which is always below the layer containing non-graphical controls - such as a listview.ZOrder arranges objects only within the layer where the object is displayed
(As you have discovered, this makes simple animation across an existing form a pain in the neck - but to be fair, I don't think easy animation of a form was a design goal of the classic VB forms engine.)
Your most recent solution works because the Picturebox is, perhaps a little confusingly, NOT a graphical control, and so sits in the front layer, and thus can be set above a listview.
Note, however, that a picturebox is not transparent, so you cannot see through it to the layers underneath, which means it will not display icons properly. This probably doesn't matter in your case.
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
Re: WHO REMEMBER this old window
my last code.
how to repeat the cycle for 3 time?
peraph with a for next? if yes where?
Code: Select all
Option Explicit
Private Sub START_ANIM()
Me.ScaleMode = vbPixels
With PICTLISTVIEW
.Visible = True
.ScaleMode = vbPixels
'.Left = x1
End With
With Timer3
.Interval = 1
.Enabled = True
End With
ySpeed = (y2 - y1) / (x2 - x1) * xSpeed
End Sub
Private Sub Command1_Click()
Call START_ANIM
End Sub
Private Sub Timer3_Timer()
With Me.PICTLISTVIEW
If .Left + xSpeed > x2 Then
Timer3.Enabled = False
.Left = x1
.Visible = False
Else
.Move .Left + xSpeed, .Top + ySpeed
End If
End With
End Sub