Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Visual Basic 2010 Programmer's Reference
This is the forum to discuss the Wrox book Visual Basic 2010 Programmer's Reference by Rod Stephens; ISBN: 9780470499832
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2010 Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 7th, 2011, 12:10 AM
Authorized User
Points: 195, Level: 3
Points: 195, Level: 3 Points: 195, Level: 3 Points: 195, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Location: Tennessee
Posts: 46
Thanks: 27
Thanked 0 Times in 0 Posts
Default Ch 10 Splash Screen

Your SplashScreen gave me an idea to fancy up a program I was rewriting for Windows Forms. I decided I would have the SplashScreen change from invisible to visible. That works fine on my desktop running Vista. Since this will run on my netbook (Win 7 Starter) and/or my laptop (XP) I ran this on both of them and my wife's desktop (XP). I got 3 different results on 4 computers. Vista worked normally, Win 7 Starter and XP on my wife's desktop gave me the fuchsia border until full opacity was reached and then it disappeared. The laptop (XP) had the fuchsia border even after the full opacity was reached. The about screen showed no fuchsia at all (4 computers). All Windows updates have been applied. Your SplashScreen program runs fine on all 4 computers. Any suggestions besides Jack Daniels??

I set the tmrOpacity interval to 20

Code:
 Public Sub ShowSplash()

        Me.TopMost = True           ' Keep on top of main form.

        ' Set the Opacity to 0 and display
        Me.Opacity = 0
        Me.Show()

        ' Enable the Opacity timer
        Me.tmrOpacity.Enabled = True

    End Sub

    Private Sub tmrOpacity_Tick(sender As System.Object, e As System.EventArgs) Handles tmrOpacity.Tick

        ' Make the splash screen become visible
        Me.Opacity += 0.01

        If Me.Opacity = 1 Then

            ' Disable the opacity timer
            Me.tmrOpacity.Enabled = False

            ' Enable the unload timer
            Me.tmrUnload.Enabled = True

        End If
    End Sub
Reply With Quote
  #2 (permalink)  
Old November 7th, 2011, 11:45 AM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

The most first thing that comes to mind is you should probably remove the form's borders and control box. They might be handled differently than the rest of the form.

If you did that and it still doesn't work, you could try setting the form's Region so it can only draw in its interior. Take a look at the examples here:

http://www.vb-helper.com/index_api.html#regions

You can use the GraphicsPath object's AddRectangle method to restrict the region to a rectangle inside the form.

(If you have trouble, let me know and I'll write an example, but I'm fighting some computer problems today.)
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
The Following User Says Thank You to Rod Stephens For This Useful Post:
zavodney (November 8th, 2011)
  #3 (permalink)  
Old November 8th, 2011, 12:06 AM
Authorized User
Points: 195, Level: 3
Points: 195, Level: 3 Points: 195, Level: 3 Points: 195, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Location: Tennessee
Posts: 46
Thanks: 27
Thanked 0 Times in 0 Posts
Default

This program is using the Transparency Key to render the fuchsia rectangle invisible. When I was having a problem getting the program to work the way I wanted it to I copied your Splash Screen program which works fine on all of my computers. I then added a second timer to control the opacity. That is when the problem occurs on my other computers. The fuchsia background color doesn't become transparent until full opacity is reached. I tried decrementing the opacity to see if that would work. When the opacity is being changed the background is not becoming transparent on my other computers. I even ran Visual Studio on my netbook and the background was visible while the opacity was changing. I changed the label text to fuschia and those completely disappeared, even while the opacity changed, but not the background. I guess I can live without the opacity changing as I have some other features I need to figure out how to accomplish. Thanks anyway.

Keith Z.
Reply With Quote
  #4 (permalink)  
Old November 8th, 2011, 02:13 AM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Hi Keith,

If you want to send me the project, I'll take a look.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
The Following User Says Thank You to Rod Stephens For This Useful Post:
zavodney (November 8th, 2011)
  #5 (permalink)  
Old November 10th, 2011, 03:08 AM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Hi Keith,

Well, I'm not sure but this does seem like a buggy feature these days. I had the problem with the background visible until Opacity = 1.

This article says TransparencyKey doesn't work if the system's color depth is greater than 24 bits:

http://support.microsoft.com/kb/822495

My system is set up for 32 bit color so that's probably my problem. It could be yours, too. I don't know why my older example would work for you.

Instead of using TransparencyKey, you could set the form's region. See this example:

http://www.vb-helper.com/howto_net_set_form_region.html

The attached example (which is in VB 2008, because that's what I had handy) does this. The ellipse doesn't quite fit the image on the form because it is centered (see the BackgroundImageLayout property) and the ellipse doesn't quite go to the edges of the image. You can fiddle with that if you like to make it fit perfectly. Or you could just make the whole background part of the ellipse image be blue and let the region clip it instead of worrying about TransparencyKey.

Here's the key code:

Code:
' Set the form's region to an ellipse.
Private Sub dlgSplash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ' Make a GraphicsPath to define the Region.
    Dim path As New System.Drawing.Drawing2D.GraphicsPath()
    path.AddEllipse(Me.ClientRectangle)

    ' Convert into a Region.
    Dim rgn As New Region(path)

    ' Restrict the form to the region.
    Me.Region = rgn
End Sub
I hope that helps.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
The Following User Says Thank You to Rod Stephens For This Useful Post:
zavodney (November 10th, 2011)
  #6 (permalink)  
Old November 10th, 2011, 12:38 PM
Authorized User
Points: 195, Level: 3
Points: 195, Level: 3 Points: 195, Level: 3 Points: 195, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Location: Tennessee
Posts: 46
Thanks: 27
Thanked 0 Times in 0 Posts
Default

Thank you for your answer. Right now I have the program running with just a plain splash screen (sigh). I'll play with this some more to make my splash screen change opacity. First I want to finish up my first book, your Visual Basic Programming 24-Hour Trainer. I've been reading this book at lunch and have been enjoying it. Thanks for 2 great books and thank you for looking at this question.

Keith Z.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
splash screen works on simulator but not on iphone briomusic BOOK: Beginning iOS 4 Application Development 3 June 9th, 2011 07:15 AM
How to createa Splash Screen awais_syed Beginning VB 6 3 August 24th, 2007 03:29 AM
why isn't my splash screen loading? nerdman978 Beginning VB 6 2 July 5th, 2007 10:32 AM
splash screen query demac43 Visual Basic 2005 Basics 2 May 15th, 2007 03:20 PM
Splash Screen dodorisio Beginning VB 6 3 March 25th, 2004 08:29 AM



All times are GMT -4. The time now is 01:34 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.