Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This question has also asked by one more guy, my question is also same as this guy

I have a set of similar forms, all the same size and background colour, and the application switches between the forms with form.open and form.close commands.
The issue I have is there is a delay during the transition, and instead of a smooth transition from one form to another there is a noticeable flash as one form closes, reveals the desktop underneath, and then the next form opens. I have tried various combinations of form.open, form.hide, form.open, and none seems to eliminate the distracting flashing between forms. Is there a way to smoothly transition forms? Something like: overlay the new form over the old form first, and then close the old form which is out of sight?

Thanks
Posted
Updated 30-Aug-15 20:51pm
v2
Comments
Richard MacCutchan 31-Aug-15 3:08am    
overlay the new form over the old form first, and then close the old form which is out of sight?
That should be easy enough to test.
Member 11927641 31-Aug-15 12:47pm    
Can you able to tell me by writing the code?
Richard MacCutchan 31-Aug-15 13:21pm    
What code? You know how to open a form, and you know how to close or hide one.
Member 11927641 1-Sep-15 0:05am    
Yes, i am using hide() code but when i click form1 button to open form2, it comes with flicker which looks annoying to me..
Richard MacCutchan 1-Sep-15 2:34am    
Sorry but I get no flicker when I do something similar. Maybe you need to show some of your code (use the Improve question link) to see if anyone can reproduce what you see.

1 solution

VB
Public Class Form2

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Top = Form1.Top
        Me.Left = Form1.Left
        timer1.enabled = True
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If Me.Width < Form1.Width - 5 Then
            Me.Width += 5
        Else
            Me.Width = Form1.Width
            Timer1.Enabled = False
        End If
        Me.Focus()
    End Sub
End Class

Add a timer in your form and set time as 1000ms
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900