zoukankan      html  css  js  c++  java
  • 2018-11-26-win10-uwp-获取窗口的坐标和宽度高度

    title author date CreateTime categories
    win10 uwp 获取窗口的坐标和宽度高度
    lindexi
    2018-11-26 15:4:0 +0800
    2018-11-26 09:49:58 +0800
    Win10 UWP

    本文告诉大家几个方法在 UWP 获取窗口的坐标和宽度高度

    获取可视范围

    获取窗口的可视大小

    Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().VisibleBounds

    获取当前窗口的坐标和宽度高度

    Window.Current.Bounds

    获取最前窗口的范围

    通过 Win32 的 Api 获取最前的窗口的范围

    IntPtr hWID = GetForegroundWindow();
    
    Rect rect;
    
    Rect* ptr = ▭
    
    GetWindowRect(GetForegroundWindow(), pAngle);
    
    return rect;
    
    
    
        [DllImport("user32.dll", CharSet = CharSet.Ansi)]
        private static extern IntPtr GetForegroundWindow();
    
        [DllImport("user32.dll", CharSet = CharSet.Ansi)]
        private unsafe static extern Boolean GetWindowRect(IntPtr intPtr, Rect* lpRect);
    
    private struct Rect
    {
        public int left;
        public int top;
        public int right;
        public int bottom;
    }
  • 相关阅读:
    FastAdmin Shopro商城安装
    MYSQL ERROR 10060
    宝塔命令
    kdevtmpfsi挖矿病毒处理
    VUE安装
    原生JS请求(AJAX)
    Bootstrap: 模态框组件
    Bootstrap: 缩略图组件
    Bootstrap: 栅格系统
    Bootstrap: 下拉菜单组件 & 分页组件
  • 原文地址:https://www.cnblogs.com/lindexi/p/12085788.html
Copyright © 2011-2022 走看看