2023年7月28日

WPF 取得螢幕解析度

 



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Interop;
 
public class Screen_tool
{
 
        public static Screen get_screen_info(Window window)
        {
            WindowInteropHelper windowInteropHelper = new WindowInteropHelper(window);
            return System.Windows.Forms.Screen.FromHandle(windowInteropHelper.Handle);
        }
 
}

沒有留言:

張貼留言