开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜