【问题标题】:Make DraggablePoint Unmoveable on chartplotter (Dynamic Data Display) C#使海图仪上的可拖动点不可移动(动态数据显示)C#
【发布时间】:2014-12-13 20:02:06
【问题描述】:

我使用的是 Microsoft Visual Studio 2010,包括参考动态数据显示。 我在 c# 代码中创建 DraggablePoint。 点创建完美,我的问题是如何使点在地图上不可移动? 我试图搜索属性 unMoveable 或 Moveable false 但没有这样的东西。 我的代码:

    // Creating the new DraggablePoint
    globalPoint = new DraggablePoint(new Point(x1,y1));

    // Set the point position
    globalPoint.Position = new Point(x1,y1);

    // Set the point on the map
    plotter.Children.Add(globalPoint);

感谢您的帮助。

【问题讨论】:

    标签: c# map point dynamic-data-display


    【解决方案1】:

    您可以注册一个回调,在点被移动时将其移回其初始位置。

    Point p = new Point(x1, y1);
    var globalPoint = new DraggablePoint(p);
    
    globalPoint.PositionChanged += (s, e) => 
    { 
        globalPoint.Position = p; 
    };
    

    【讨论】:

    猜你喜欢
    • 2014-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-03
    • 2012-03-09
    • 1970-01-01
    • 1970-01-01
    • 2013-04-28
    相关资源
    最近更新 更多