none
winform应用,运行在win10系统125%缩放的界面上,当创建System.Windows.Media.MediaPlayer时,窗体会重绘变小 RRS feed

  • Question

  • winform应用,运行在win10系统125%缩放的界面上,当创建System.Windows.Media.MediaPlayer时,窗体会重绘变小;

    在StackOverflow上发现了14年的提问,请问现在是否有更好的方式解决?

    https://stackoverflow.com/questions/20926549/mediaelement-mediaplayer-classes-break-dpi-virtualization-on-windows-forms-app?r=SearchResults

    Tuesday, 27 July 2021 10:52 AM

All replies

  • 你好,

    根据我的测试,我发现并没有重现你的问题,在我创建了System.Windows.Media.MediaPlayer后,即使我把系统缩放到125%的界面上,窗体只会自适应变大,这是正常的。

    你可以提供下相关截图吗,以便于我们能够分析你的问题。

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, 28 July 2021 8:36 AM
    Moderator
  • 你好,感谢回答

    关于该情况,已经使用提问中提到的解决办法处理了。

    具体问题效果是应该最大化的窗体只显示在屏幕的左上角。

    示例代码:

        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
    
                WindowState = FormWindowState.Maximized;
    
                Task.Factory.StartNew(() => { new System.Windows.Media.MediaPlayer(); });
            }
            public override Size MaximumSize
            {
                get
                {
                    return new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
                }
                set
                {
                    base.MaximumSize = value;
                }
            }
        }



    Wednesday, 28 July 2021 9:56 AM