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);

  • 相关阅读:
    个性化排序算法实践(三)——deepFM算法
    Textbox输入状态提示
    CheckBox状态多选
    TextBox各种设置
    CheckBox多选
    简单的动画
    样式中调用方法
    textbox获取焦点选中内容
    linq一般用法
    自定义表头Datagrid
  • 原文地址:https://www.cnblogs.com/ysharp/p/2246033.html
Copyright © 2011-2022 走看看