From 9bf2cb803eabdbccfaaa7481dff115ca4783d669 Mon Sep 17 00:00:00 2001 From: RedShirtMB Mark Linton redshirt linton Date: Sun, 19 Aug 2012 11:45:08 -0700 Subject: [PATCH] Adjust splashscreen layout and hide close button. --- MediaBrowser.Common/UI/Splash.xaml | 6 +++--- MediaBrowser.Common/UI/Splash.xaml.cs | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Common/UI/Splash.xaml b/MediaBrowser.Common/UI/Splash.xaml index 3927017f9c..85fc9d684f 100644 --- a/MediaBrowser.Common/UI/Splash.xaml +++ b/MediaBrowser.Common/UI/Splash.xaml @@ -1,11 +1,11 @@  + Title="MediaBrowser" Height="346" Width="600" ShowInTaskbar="False" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" + WindowState="Normal" WindowStyle="SingleBorderWindow" Background="Black" Loaded="Splash_Loaded"> - diff --git a/MediaBrowser.Common/UI/Splash.xaml.cs b/MediaBrowser.Common/UI/Splash.xaml.cs index 6d1d313e81..c8653646c0 100644 --- a/MediaBrowser.Common/UI/Splash.xaml.cs +++ b/MediaBrowser.Common/UI/Splash.xaml.cs @@ -8,8 +8,10 @@ using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; +using System.Runtime.InteropServices; using System.Windows.Media; using System.Windows.Media.Imaging; +using System.Windows.Interop; using System.Windows.Shapes; using MediaBrowser.Model.Progress; @@ -21,6 +23,13 @@ namespace MediaBrowser.Common.UI /// public partial class Splash : Window { + private const int GWL_STYLE = -16; + private const int WS_SYSMENU = 0x80000; + [DllImport("user32.dll", SetLastError = true)] + private static extern int GetWindowLong(IntPtr hWnd, int nIndex); + [DllImport("user32.dll")] + private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); + public Splash(Progress progress) { @@ -34,5 +43,11 @@ namespace MediaBrowser.Common.UI this.lblProgress.Content = e.Description; this.pbProgress.Value = (double)e.PercentComplete; } + + private void Splash_Loaded(object sender, RoutedEventArgs e) + { + var hwnd = new WindowInteropHelper(this).Handle; + SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU); + } } }