开发者

WPF: Displaying two windows simultaneously (extended desktop) in full screen

开发者 https://www.devze.com 2022-12-24 11:04 出处:网络
I just want to find out how to run two WPF windows (one in extended desktop) while开发者_运维技巧 in Full screen mode.Add System.Windows.Forms.dll and System.Drawing.dll references and try this:

I just want to find out how to run two WPF windows (one in extended desktop) while开发者_运维技巧 in Full screen mode.


Add System.Windows.Forms.dll and System.Drawing.dll references and try this:

public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);

        foreach (var screen in System.Windows.Forms.Screen.AllScreens)
        {
            var window = new Window1
            {
                WindowStartupLocation = WindowStartupLocation.Manual,
                WindowState = WindowState.Maximized,
                WindowStyle = WindowStyle.None,
                Title = screen.DeviceName,
                Width = screen.Bounds.Width,
                Height = screen.Bounds.Height,
                Left = screen.Bounds.Left,
                Top = screen.Bounds.Top,
            };
            window.Show();
        }
    }
}

Don't forget to remove StartupUri="Window1.xaml" from App.xaml.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号