SplashScreen, kenarlıksız başka bir Pencere'dir ve yeniden boyutlandırılamaz (ayrıca herhangi bir şekilde etkileşimde bulunamazsınız). Muhtemelen görev çubuğundan gizlemek, ekranda ortalamak, vb. Isteyebilirsiniz. İstediğiniz efekti elde edene kadar çeşitli ayarlarla oynayın.
<Window x:Class="MyWhateverApp.MySplashScreen"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ShowInTaskbar="False"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
Background="Transparent"
AllowsTransparency="True"
Title="Sandbox Splash Screen"
SizeToContent="Width"
Topmost="True"
Height="{Binding RelativeSource={RelativeSource Self},
Path=ActualWidth}">
<Border CornerRadius="8" Margin="15">
<Border.Background>
<ImageBrush ImageSource="Resources\sandtexture.jpeg"
Stretch="Fill" />
</Border.Background>
<Border.Effect>
<DropShadowEffect Color="#894F3B"
BlurRadius="10"
Opacity="0.75"
ShadowDepth="15" />
</Border.Effect>
<TextBlock FontSize="40"
FontFamily="Bauhaus 93"
Foreground="White"
Margin="10"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Text="WPF 3.5 Sandbox">
<TextBlock.Effect>
<DropShadowEffect Color="Black" />
</TextBlock.Effect>
</TextBlock>
</Border>
</Window>
Sonraki, başlangıç penceresini kaldırmak için App.xaml dosyasını değiştirmek ve yerine Başlangıç olay yükseltmek:
İşte
teorisini kanıtlamak için yaklaşık 5 dakika içinde çırpılmış hızlı biri
<Application x:Class="MyWhateverApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Startup="Application_Startup">
<Application.Resources>
</Application.Resources>
</Application>
Ve arkadaki kodda, Application_Startup olayını en iyi olduğunu düşündüğünüz şekilde kullanın. Örneğin:
Window1 mainWindow = null;
private void Application_Startup(object sender, StartupEventArgs e)
{
MySplashScreen splash = new MySplashScreen();
splash.Show();
mainWindow = new Window1();
mainWindow.Show();
splash.Close();
}
ait
olası yinelenen [WPF animasyonlu ekranı] (http://stackoverflow.com/questions/3677653/wpf-animated-splash-screen) –