Solved

vb.net forms transition

Posted on 2013-11-23
3
887 Views
Last Modified: 2013-11-24
I've the following situation: I'm developing a kiosk app (you know, without keyboard, only touch screen) where form1 calls form2, and this one call form3, etc,etc.

Those forms have the same background image (1500x1121, 150x150dpi,24 bits) streched to a 1280x1024 form size and most of them loads at least 2 images as buttons and one extra image as information text.

The code i'm using to call from one form to another is the following:

        Dim frmSCR001 As New SCR001
        frmSCR001.Show()
        Me.Dispose(False)

The fact is that the next screen flashes when is loaded. Is possible make that transition between forms more smoothly?

In VB6 I really don't remember this situation.

Tks in advance,
Leonel Rocha
0
Comment
Question by:leorocha
3 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 39672093
Try something like this out.  You start the Opacity() out at 0 (zero) and then sweep it up to 1 (one):
Public Class Form1

	Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
		Dim f2 As New Form2
		f2.Opacity = 0
		f2.StartPosition = FormStartPosition.Manual
		f2.Size = Me.Size
		f2.Location = Me.Location
		f2.Show()
		For i As Integer = 5 To 100 Step 5
			f2.Opacity = CDbl(i) / CDbl(100)
			Application.DoEvents()
			System.Threading.Thread.Sleep(100)
		Next
	End Sub

End Class

Open in new window

0
 
LVL 40
ID: 39672329
Usually, a form does not show until after its Load event terminates. But it can be forced to show before that point with a Show method or by setting its Visible property to True in the Load event code. When you do that, the form appears sooner, but might not be completely built, which might cause flashing.
0
 

Author Closing Comment

by:leorocha
ID: 39672336
It's  working, thanks!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error in page 3 46
Exit the loop 4 35
SSRS troubles 4 20
How can my static class become undefined?? 8 18
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now