如何使我的 WPF 应用程序全屏显示
How to make my WPF application full screen
我一直在构建一个包含媒体播放器的小型 WPF 应用程序。除了让播放器全屏显示这一部分外,我几乎完成了。我已经到了隐藏 Windows 任务栏的地步,播放器覆盖了所有内容,任务栏所在的位置除外。所以播放器是全屏的,除了任务栏通常所在的位置,你只能看到桌面背景的一部分。
private void Full_Click(object sender, RoutedEventArgs e)
{
this.WindowStyle = WindowStyle.None;
this.ResizeMode = ResizeMode.NoResize;
this.WindowState = WindowState.Maximized;
Taskbar.Hide();
player.Stretch = Stretch.Fill;
controlPanel.Visibility = Visibility.Collapsed;//hides media controls
player.Height = System.Windows.SystemParameters.PrimaryScreenHeight + 200;//I tried to set the height to fill the entire screen
Full.Visibility = Visibility.Hidden;//hides full screen control //Im aware that may be too large of an increase but I
CloseFull.Visibility = Visibility.Visible;//shows exit control //wanted to see if it would work at all
}
为什么要隐藏任务栏?
这应该足够了:
WindowStyle = WindowStyle.None;
ResizeMode = ResizeMode.NoResize;
WindowState = WindowState.Maximized;
Topmost = true;
我一直在构建一个包含媒体播放器的小型 WPF 应用程序。除了让播放器全屏显示这一部分外,我几乎完成了。我已经到了隐藏 Windows 任务栏的地步,播放器覆盖了所有内容,任务栏所在的位置除外。所以播放器是全屏的,除了任务栏通常所在的位置,你只能看到桌面背景的一部分。
private void Full_Click(object sender, RoutedEventArgs e)
{
this.WindowStyle = WindowStyle.None;
this.ResizeMode = ResizeMode.NoResize;
this.WindowState = WindowState.Maximized;
Taskbar.Hide();
player.Stretch = Stretch.Fill;
controlPanel.Visibility = Visibility.Collapsed;//hides media controls
player.Height = System.Windows.SystemParameters.PrimaryScreenHeight + 200;//I tried to set the height to fill the entire screen
Full.Visibility = Visibility.Hidden;//hides full screen control //Im aware that may be too large of an increase but I
CloseFull.Visibility = Visibility.Visible;//shows exit control //wanted to see if it would work at all
}
为什么要隐藏任务栏?
这应该足够了:
WindowStyle = WindowStyle.None;
ResizeMode = ResizeMode.NoResize;
WindowState = WindowState.Maximized;
Topmost = true;