Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. Feedback will be sent to Microsoft: By pressing the submit button, your feedback will be used to improve Microsoft products and services. Privacy policy. Thank you. PrimaryScreen , which is apparently not WPF. Is there a WPF alternative that gives me the screen resolution or something like that?
You can still use the Screen class from a WPF app. You just need to reference the System. Forms assembly from your application. Once you've done that, and referenced System. Drawing for the example below :. What about the SystemParameters class in PresentationFramework? It has a WorkArea property that seems to be what you are looking for. If either the Left or Top properties aren't specified, their values are determined by Windows.
Setting the WindowStartupLocation property to CenterScreen causes a window to be positioned in the center of the screen that contains the mouse cursor. Setting the WindowStartupLocation property to CenterOwner causes a window to be positioned in the center of its owner window see Window. Owner , if specified.
If an owner window is not specified, the position of the window is determined in the same way as if the WindowStartupLocation property is set to Manual. Posted by: admin November 23, Leave a comment. I want to center my WPF app on startup on the primary screen. I know I have to set myWindow. Left and myWindow. Top, but where do I get the values?
I found System. PrimaryScreen , which is apparently not WPF.
0コメント