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;
    }
  • 相关阅读:
    冲刺成果演示
    c#输入串字符不符
    课堂测试—数据清洗
    mapreduce实验
    问题纠错
    软件需求阅读笔记第一篇
    暑假第五周总结
    暑假第四周总结
    暑假第三周总结
    暑假第二周总结
  • 原文地址:https://www.cnblogs.com/lindexi/p/12085788.html
Copyright © 2011-2022 走看看