C# 获取屏幕的大小

    xiaoxiao2025-11-18  1

    WinForm

    int iActulaWidth = Screen.PrimaryScreen.Bounds.Width;

    int iActulaHeight = Screen.PrimaryScreen.Bounds.Height ;

      System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width       System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height Screen.PrimaryScreen.WorkingArea.Height; Screen.PrimaryScreen.WorkingArea.Width;

     

    WPF下的:

    double dWidth = System.Windows.SystemParameters.PrimaryScreenWidth;

    double dHeight = System.Windows.SystemParameters.PrimaryScreenHeight;

    double dWidth2 = ActualWidth; //获取此元素的呈现宽度。若此元素时全屏的,则可以获得屏幕大小(-_-!!!)

    double dHeight2 = ActualHeight; //获取此元素的呈现高度。

    转载请注明原文地址: https://ju.6miu.com/read-1304309.html
    最新回复(0)