zoukankan      html  css  js  c++  java
  • 鼠标 控件 位置 关系

    //To get a point relative to a UI element: private Point GetPointRelativeToElement(UIElement element, Point point) {       return element.TranslatePoint(point, element); }

    //To get the absolute screen position of a UI element, private Point GetAbsolutePositionOfElement(UIElement element) {      return element.PointToScreen(new Point(0, 0)); }

    //To get the absolute midpoint of a UI element, private Point GetAbsoluteMidPointOfElement(FrameworkElement element) {             Point midPoint = element.TranslatePoint(new Point(element.Width / 2, element.Height / 2), element);             Point absolute = PointToScreen(midPoint);             return absolute; }

    To get the relative and absolute mouse position,

    private Point GetAbsoluteMousePosition() {        return PointToScreen(Mouse.GetPosition(this)); } private Point GetMousePositionRelativeToElement(UIElement element) {        return Mouse.GetPosition(element); }

    //To programmatically adjust mouse position, using System.Runtime.InteropServices; [DllImport("user32.dll")] static extern bool SetCursorPos(int X, int Y);

  • 相关阅读:
    MySQL重置密码
    linux下自动备份脚本并上传到ftp服务器
    nginx配置
    WIFI防蹭网
    无线路由知识
    009汇编环境搭建
    008 计算机不会加法
    007计算机不会做加法
    006源码反码补码
    005有符号数和无符号数
  • 原文地址:https://www.cnblogs.com/ysharp/p/2246033.html
Copyright © 2011-2022 走看看