|
-
Apr 2nd, 2010, 11:50 PM
#1
Frenzied Member
Re: How can I do this in VB6? (sample video included)
Nikole, while this could use a whole lot of improvement, as it is a bit jerky on my system in debug mode, and it needs the transparent effect added to it. I hope it gives you some ideas...
Start a new standard exe project and add this code to form1...
Code:
Option Explicit
Private Sub Form_Load()
Me.WindowState = vbMaximized
Me.Visible = True
Form2.Show vbModeless, Me
Form2.Visible = True
Form2.SetFocus
End Sub
Now add a form (form2) and add a timer to form2 (timer1) and add the code...
Code:
Option Explicit
Dim Direction As Byte, ToCenter As Boolean
Private Sub Form_Click()
Direction = CByte(3 * Rnd)
Me.Caption = Direction
Timer1.Interval = 50
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Randomize
Me.AutoRedraw = True
Timer1.Enabled = False
Me.Left = (Screen.Width / 2) - (Me.Width / 2)
Me.Top = (Screen.Height / 2) - (Me.Height / 2)
End Sub
Private Sub Timer1_Timer()
Dim P As Integer
Select Case Direction
Case 0 'headed north
Me.Top = Me.Top - 150
If ToCenter = True Then
If Me.Top <= ((Screen.Height / 2) - (Me.Height / 2)) Then
Me.Top = (Screen.Height / 2) - (Me.Height / 2)
Me.Cls
Timer1.Enabled = False
ToCenter = False
End If
Else
If Me.Top <= 0 - Me.Height Then
Me.Print "From the top"
Direction = 2 'headed south
ToCenter = True
End If
End If
Case 1 'headed east
Me.Left = Me.Left + 150
If ToCenter = True Then
If Me.Left >= ((Screen.Width / 2) - (Me.Width / 2)) Then
Me.Left = (Screen.Width / 2) - (Me.Width / 2)
Me.Cls
Timer1.Enabled = False
ToCenter = False
End If
Else
If Me.Left >= Screen.Width Then
Me.Print "From the right"
Direction = 3 'headed west
ToCenter = True
End If
End If
Case 2 'headed south
Me.Top = Me.Top + 150
If ToCenter = True Then
If Me.Top >= ((Screen.Height / 2) - (Me.Height / 2)) Then
Me.Top = (Screen.Height / 2) - (Me.Height / 2)
Me.Cls
Timer1.Enabled = False
ToCenter = False
End If
Else
If Me.Top >= Screen.Height Then
Me.Print "From the bottom"
Direction = 0
ToCenter = True
End If
End If
Case 3
Me.Left = Me.Left - 150
If ToCenter = True Then
If Me.Left <= ((Screen.Width / 2) - (Me.Width / 2)) Then
Me.Left = (Screen.Width / 2) - (Me.Width / 2)
Me.Cls
Timer1.Enabled = False
ToCenter = False
End If
Else
If Me.Left <= (0 - Me.Width) Then
Me.Print "From the left"
Direction = 1
ToCenter = True
End If
End If
End Select
End Sub
run and click on form2
Improvements: Do all the calculations once in form load. Play with the timer settings and the movement rate to make it smoother/faster/etc.
Good Luck
Option Explicit should not be an Option!
-
Apr 3rd, 2010, 01:16 AM
#2
Re: How can I do this in VB6? (sample video included)
 Originally Posted by Nikole
Hi, LaVolpe and guys: I've updated the video, sorry,i'm not so good.
This is the scenario:
1) Form1: Only to host an image background.
2) frmSlide: when form load, frmSlide slide from Bottom ---> to center of screen with album covers.
3) When i click in a cover, frmSlide go from center of screen to top of screen and dispear in the opacity. (List like your example of yesterday)..ok
4) now, frmSlide come from top to center of screen with all songs (ListBox) of the album.
It's possible to make a snapshot of the form with controls and move it, in any direction? top to bottom, bottom to top, right to left...
UPDATED Video:
http://www.youtube.com/watch?v=sSLilt9IhjI
If you know Expression Blend and VB.Net, then I think they are a perfect combination for creating nice looking programs(with animations and lot more) ! 
 Originally Posted by Keithuk
Well Nikole any movie you download from YouTube is a flash movie *.swf which you can add to a Resource file and extract it and play it from there. You can have as many slideshows as you want too.
I'm not sure I know what you mean by Expression Blend?
I think Nikole wants to do the animation (form transition), just like in the video. She is creating those videos as an example. And she wants to do it in VB6.
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Apr 3rd, 2010, 08:14 AM
#3
Thread Starter
Lively Member
Re: How can I do this in VB6? (sample video included)
 Originally Posted by akhileshbc
If you know Expression Blend and VB.Net, then I think they are a perfect combination for creating nice looking programs(with animations and lot more) !
I think Nikole wants to do the animation (form transition), just like in the video. She is creating those videos as an example. And she wants to do it in VB6. 
Maybe but I don't know VB.NET, Array controls does not exist anymore in .NET. Maybe i need to buy a book of .NET, but i need to do now a complex app and i haven't time ...
-
Apr 3rd, 2010, 08:09 AM
#4
Thread Starter
Lively Member
Re: How can I do this in VB6? (sample video included)
 Originally Posted by vb5prgrmr
Nikole, while this could use a whole lot of improvement, as it is a bit jerky on my system in debug mode, and it needs the transparent effect added to it. I hope it gives you some ideas...
Start a new standard exe project and add this code to form1...
Code:
Option Explicit
Private Sub Form_Load()
Me.WindowState = vbMaximized
Me.Visible = True
Form2.Show vbModeless, Me
Form2.Visible = True
Form2.SetFocus
End Sub
Now add a form (form2) and add a timer to form2 (timer1) and add the code...
Code:
Option Explicit
Dim Direction As Byte, ToCenter As Boolean
Private Sub Form_Click()
Direction = CByte(3 * Rnd)
Me.Caption = Direction
Timer1.Interval = 50
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Randomize
Me.AutoRedraw = True
Timer1.Enabled = False
Me.Left = (Screen.Width / 2) - (Me.Width / 2)
Me.Top = (Screen.Height / 2) - (Me.Height / 2)
End Sub
Private Sub Timer1_Timer()
Dim P As Integer
Select Case Direction
Case 0 'headed north
Me.Top = Me.Top - 150
If ToCenter = True Then
If Me.Top <= ((Screen.Height / 2) - (Me.Height / 2)) Then
Me.Top = (Screen.Height / 2) - (Me.Height / 2)
Me.Cls
Timer1.Enabled = False
ToCenter = False
End If
Else
If Me.Top <= 0 - Me.Height Then
Me.Print "From the top"
Direction = 2 'headed south
ToCenter = True
End If
End If
Case 1 'headed east
Me.Left = Me.Left + 150
If ToCenter = True Then
If Me.Left >= ((Screen.Width / 2) - (Me.Width / 2)) Then
Me.Left = (Screen.Width / 2) - (Me.Width / 2)
Me.Cls
Timer1.Enabled = False
ToCenter = False
End If
Else
If Me.Left >= Screen.Width Then
Me.Print "From the right"
Direction = 3 'headed west
ToCenter = True
End If
End If
Case 2 'headed south
Me.Top = Me.Top + 150
If ToCenter = True Then
If Me.Top >= ((Screen.Height / 2) - (Me.Height / 2)) Then
Me.Top = (Screen.Height / 2) - (Me.Height / 2)
Me.Cls
Timer1.Enabled = False
ToCenter = False
End If
Else
If Me.Top >= Screen.Height Then
Me.Print "From the bottom"
Direction = 0
ToCenter = True
End If
End If
Case 3
Me.Left = Me.Left - 150
If ToCenter = True Then
If Me.Left <= ((Screen.Width / 2) - (Me.Width / 2)) Then
Me.Left = (Screen.Width / 2) - (Me.Width / 2)
Me.Cls
Timer1.Enabled = False
ToCenter = False
End If
Else
If Me.Left <= (0 - Me.Width) Then
Me.Print "From the left"
Direction = 1
ToCenter = True
End If
End If
End Select
End Sub
run and click on form2
Improvements: Do all the calculations once in form load. Play with the timer settings and the movement rate to make it smoother/faster/etc.
Good Luck
Thanks for you effort! U are so sweet
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|