且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在特定屏幕点加载WPF应用程序

更新时间:2023-12-05 16:19:28

这里: https://msdn.microsoft.com/en-us/library/system.windows。 window.windowstartuplocation%28v = vs.110%29.aspx [ ^ ]。



你做的事情没什么意义。如果您希望多个应用程序在屏幕上自行排列主窗口,则首先需要查询屏幕大小。此外,您还需要照顾尺寸。最后,您的应用程序不会了解彼此;这样合理吗?你想让那个预定义的窗口位置独立于其他窗口吗?也许,如果你安排一些固定的应用程序,***将它们集成在一起?



-SA

How can I load a WPF in a specific screen point? I tried next code and I searched about other resources like the WorkingArea or WindowStartupLocation but I could not do it.

private void Application_Startup(object sender, StartupEventArgs e)
        {
                     base.OnStartup(e);
MainWindow m = new MainWindow();
Point point = m.PointToScreen(
                            new Point(320, 120));double dpiX =
               96.0 * source.CompositionTarget.TransformToDevice.M11;
           double dpiY =
               96.0 * source.CompositionTarget.TransformToDevice.M22;

           m.Left = point.X * 96.0 / dpiX; ;
           m.Top = point.Y * 96.0 / dpiX; ;*/&lt;/pre&gt;</pre>
   m.Show();
}


The goal is to load different WPF apps and fill the screen with them. Is there a better way to do this?
Help please :)

Here: https://msdn.microsoft.com/en-us/library/system.windows.window.windowstartuplocation%28v=vs.110%29.aspx[^].

What you are doing makes little sense. If you want several applications to self-arrange their main windows on the screen, you first need to inquire the screen size. Also, you need to take care of sizes as well. Finally, your applications don't "know" about each other; is that reasonable? Do you want to have that predefined window location independent from other ones? Maybe, if you arrange some fixed set of applications, it would be better to integrate them all in one?

—SA