Click here to Skip to main content
Click here to Skip to main content

Non Rectangular simple splash screen WPF

, 6 Dec 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
A WPF sample, edit and make your own splash

Introduction

Here is a simple XAML created splash screen for Windows application. It is quite good looking and completely editable according to your needs.

Background

In code behind, just adjust the timespan value for how much time you want to show splash.

Using the Code

The grid inside the window uses a path to make its non rectangular shape. The XAML is here:

 <Path Stroke="DarkGray" StrokeThickness="5" SnapsToDevicePixels="True">
                <Path.Fill>
                    <LinearGradientBrush StartPoint="0.2,0" EndPoint="0.8,1" >
                        <LinearGradientBrush.GradientStops>
                            <GradientStop Color="White"  Offset="0"></GradientStop>
                            <GradientStop Color="SkyBlue"  Offset="0.45"></GradientStop>
                            <GradientStop Color="White" Offset="0.8"></GradientStop>
                            <GradientStop Color="Gray" Offset="1"></GradientStop>
                        </LinearGradientBrush.GradientStops>
                    </LinearGradientBrush>
                </Path.Fill>
                <Path.Data>
                    <PathGeometry>
                        <PathGeometry.Figures>
                            <PathFigure StartPoint="0,0" IsClosed="True">
                                <LineSegment Point="405,0"></LineSegment>
                                <LineSegment Point="600,175"></LineSegment> 
                                <LineSegment Point="400,270"></LineSegment>
                                <LineSegment Point="90,270"></LineSegment>
                                <LineSegment Point="0,170"></LineSegment>
                            </PathFigure>
                        </PathGeometry.Figures>
                    </PathGeometry>
                </Path.Data>
                <Path.RenderTransform>
                    <ScaleTransform ScaleX="1.3" ScaleY="1.3"></ScaleTransform>
                </Path.RenderTransform>
 
            </Path>  

In code behind:

 private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            DispatcherTimer dispatcherTimer = new DispatcherTimer();
            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 8);
            dispatcherTimer.Start();
 
        }
 
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Closing -= Window_Closing;
            e.Cancel = true;
            var anim = new DoubleAnimation(0, (Duration)TimeSpan.FromSeconds(1));
            anim.Completed += (s, _) => this.Close();
            this.BeginAnimation(UIElement.OpacityProperty, anim);
        }
 
        private void dispatcherTimer_Tick(object sender, EventArgs e)
        {
            this.Close();
        } 

Output

License

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

Share

About the Author

choudhary.sumit
Software Developer
India India
No Biography provided

Comments and Discussions

 
GeneralMy vote of 2 PinmemberBadassAlien9-Dec-12 11:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.1411023.1 | Last Updated 6 Dec 2012
Article Copyright 2012 by choudhary.sumit
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid