Results 1 to 16 of 16

Thread: Good Looking Splash Screen

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    14

    Good Looking Splash Screen

    Hi All

    Im trying to make a decent splash screen with rounded corners and shadow but whatever i do it look horrible

    I have managed to make one with rounded corners using regions but the edges are jaggy

    what i am after is something like the splash screen that shows when you run VS2010 (Pic Attached)

    I spent days googling but all have same code

    any ideas?

    Mark
    Name:  splash.jpg
Views: 4489
Size:  118.2 KB

  2. #2
    Junior Member
    Join Date
    Mar 2013
    Posts
    16

    Re: Good Looking Splash Screen

    Well, you could design the splash screen as image in photoshop and then use it in your source as background image or stuff like that

    Just a suggestion

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    14

    Re: Good Looking Splash Screen

    Thanks Pwned

    Already tried that but i want it to be transparent on the edges and the corners are even more jagged than using regions

    there must be a way otherwise how did Microsoft do it?

  4. #4
    PowerPoster boops boops's Avatar
    Join Date
    Nov 2008
    Location
    Holland/France
    Posts
    3,201

    Re: Good Looking Splash Screen

    Microsoft did it by using WPF. But there is no need to learn WPF to use it to make a shaped window with smoothed edges: the "Shaped Form" link in my signature gives step by step instructions on how to do it. Bring your own image. I haven't tried using it as a splash screen at startup but I assume it is possible because the Form can be temporarily hidden.

    BB

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    14

    Re: Good Looking Splash Screen

    Quote Originally Posted by boops boops View Post
    Microsoft did it by using WPF. But there is no need to learn WPF to use it to make a shaped window with smoothed edges: the "Shaped Form" link in my signature gives step by step instructions on how to do it. Bring your own image. I haven't tried using it as a splash screen at startup but I assume it is possible because the Form can be temporarily hidden.

    BB
    Thanks boops

    Tried it and cannot get it to work

    I followed the guide and I think I got it all right except in point 8 where it says add reference to WPFShapedForm (under Projects tab) there are no projects under the projects tab so I cannot add anything

    The code I have put in the button is

    Class MainWindow
    Private shapedform As New WpfForm.MainWindow
    Private Sub MainWindow_Initialized(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Initialized
    Me.Topmost = True
    End Sub

    Private Sub MainWindow_MouseLeftButtonDown(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles Me.MouseLeftButtonDown
    e.Handled = True
    Me.DragMove()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
    shapedform.Show()
    End Sub
    End Class

    The code in the main window is as follows

    Class MainWindow
    Private shapedform As New WpfForm.MainWindow
    Private Sub MainWindow_Initialized(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Initialized
    Me.Topmost = True
    End Sub

    Private Sub MainWindow_MouseLeftButtonDown(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles Me.MouseLeftButtonDown
    e.Handled = True
    Me.DragMove()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
    shapedform.Show()
    End Sub

    End Class

    when i run it I get a stack overflow at the following line
    "Private shapedform As New WpfForm.MainWindow"
    the error is as follows


    An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

    Any ideas?

    Your help is greatly appreciated

    Mark

  6. #6
    PowerPoster boops boops's Avatar
    Join Date
    Nov 2008
    Location
    Holland/France
    Posts
    3,201

    Re: Good Looking Splash Screen

    I can't think why you can't find the reference to the WPF project. Are both the Form project and the WPF project part of the same solution (see Solution Explorer)? If not, maybe I need to make it clearer in steps 1 and 2.

    BB

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    14

    Re: Good Looking Splash Screen

    Quote Originally Posted by boops boops View Post
    I can't think why you can't find the reference to the WPF project. Are both the Form project and the WPF project part of the same solution (see Solution Explorer)? If not, maybe I need to make it clearer in steps 1 and 2.

    BB
    Hi Boops

    Right I sorted the Project thing I only had a WPF application no main form

    It works great I now have a shdowed window

    one thing though is the image i am using is a png file of my company logo with a transparent background

    when i run the wpf form i just get a rectangle with a shadow and the logo on it i was expecting just the logo to appear with no background just like your ghost image

    is it the type of image i am using?

    Mark

  8. #8
    PowerPoster boops boops's Avatar
    Join Date
    Nov 2008
    Location
    Holland/France
    Posts
    3,201

    Re: Good Looking Splash Screen

    png format is perfect for images with transparency. In the WPF project, make sure that the AllowsTransparency property of MainWindow is checked. It looks like I forgot to mention that!

  9. #9

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    14

    Re: Good Looking Splash Screen

    Thanks Boops I worked it out and it works great

    now if i can just work out how to make it pause for 5 seconds then load another i will be set

  10. #10

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    14

    Re: Good Looking Splash Screen

    Boops

    One more thing I have been trying to get a second wpf window to open from a button on the 1st wpf form. I did exactly the same as wht your code says for the first but when I click the button i just get another copy of the same window coming up

    any ideas

  11. #11

  12. #12

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    14

    Re: Good Looking Splash Screen

    Hi Boops

    Yes I have three projects
    1. "WPFShapedForm" (This one is a standard Form)
    2. "ShapedForm" (this is the first WPF Application opened from a button on "WPFShapedForm" using "shapedform.Show()" )
    3. "SecondWindow" (This is a 2nd WPF application created using the same way as the first)

    I have created a button on "ShapedForm" When it is clicked it has the code "SecondWindow.Show()

    I get the error "show is not a member of SecondWindow"

    Now on the standard form there are two extra lines that pertain to the first WPF Form
    Imports ShapedForm
    Private shapedform As New MainWindow

    The Private statement goes in fine as "Private SecondWindowAs New MainWindow"
    If I put in "Imports SecondWindow" it has the error "Namespace or type specified in the imports "SecondWindow" does not contain any public member or cannot be found

    Any Ideas?

    Mark
    Last edited by markbarr; May 19th, 2013 at 09:44 AM.

  13. #13
    PowerPoster boops boops's Avatar
    Join Date
    Nov 2008
    Location
    Holland/France
    Posts
    3,201

    Re: Good Looking Splash Screen

    Don't start a new project for the second WPF window. Add the second window to the same wpf project using the Visual Studio menu (Project/Add Window).

  14. #14

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    14

    Re: Good Looking Splash Screen

    hi boops

    still no luck i'm afraid

    I deleted the 3rd project so now i only have
    1. "WPFShapedForm" (This one is a standard Form)
    2. "ShapedForm" (this is the first WPF Application opened from a button on "WPFShapedForm" using "shapedform.Show()" )

    Added a new WPF window to "ShapedForm"
    Designed as per your guide.
    In standard form "WPF SHapedForm" Declared window as in
    "Private Window1 As New MainWindow"


    Added button to "WPFShapedForm" with the following code on the button click
    Window1.show()

    When run the 1st window shows up

    when button is clicked 1st wpf form comes up again when it should be the 2nd one "Window1"

    First WPF Window is called "MainWindow"
    Second WPF Window is called "Window1"

    If I add a button to the 1st WPF window "MainWindow" with "window1.show()" on the onclick event it recognizes window1 but there is no show option on the list only "ShowActivatedProperty" or "ShowInTaskBarProperty"



    I'm sure it something i'm not doing but cant work it out

    Thanks

    Mark
    Last edited by markbarr; May 20th, 2013 at 10:59 AM.

  15. #15
    PowerPoster boops boops's Avatar
    Join Date
    Nov 2008
    Location
    Holland/France
    Posts
    3,201

    Re: Good Looking Splash Screen

    Try declaring Window1 (or whatever you want to call it) as a New Window1. It's probably wise not to call it Window1 since you end up confusing the instance name with the class name.

    BB

  16. #16

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    14

    Re: Good Looking Splash Screen

    Thank you boops

    I declared it using "Private Window1 As New Window1"

    and then put "Window1.Show()" on the button on the first WPF window and it works a treat

    Your a star

    Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width