Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hey all i have the following code sliding from the bottom of the main form position to the middle of the main form.

 

main form

Dim Viewform2 As New Form2

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
   Me.AddOwnedForm(Viewform2)
   Viewform2.Show()

   Call ChangeChildFormLayout()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
   Dim intX As Integer = Me.Top + Me.Height
   Dim opacityNum As Short = 0
   Dim slideTo As Integer = Me.Top + Me.Height - 210

   Do Until intX = slideTo
       With Viewform2
           .TopMost = True
           .Opacity = intX
           .Top = intX
           .Height = 220
           .Left = Me.Left
           .Width = Me.Width
       End With
       Debug.Print(intX)
       intX -= 1

       If opacityNum <> 101 Then
           opacityNum += 1
       End If

       Application.DoEvents()
   Loop
End Sub

Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
   Call ChangeChildFormLayout()
End Sub

Private Sub ChangeChildFormLayout()
   With Viewform2
       .Opacity = 0
       .Top = Me.Top + Me.Height
       .Height = 200
       .Left = Me.Left
       .Width = Me.Width
   End With
End Sub

slide form

no code, just a form thats width 292 and height 266

This code works but its very choppy when the slider form slides up. Also, i am unable to get the opacity correct as well where it fades in and then out when it leaves.

 

Does anyone have any suggestions on how to correct this?

 

Thanks!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...