Map.Controls/MapControl/MapChina.xaml.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace Map.Controls
{
    /// <summary>
    /// MapChina.xaml 的交互逻辑
    /// </summary>
    public partial class MapChina : UserControl
    {
        private bool isMouseLeftButtonDown = false;
        Point previousMousePoint = new Point(0, 0);
        public MapChina()
        {
            InitializeComponent();
        }

        private void UserControl_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            this.sfr.CenterX = mymap.ActualWidth / 2;
            this.sfr.CenterY = mymap.ActualHeight / 2;
            if (sfr.ScaleX < 0.3 && sfr.ScaleY < 0.3 && e.Delta < 0)
            {
                return;
            }
            if ((e.Delta < 0 && sfr.ScaleX > 0.2) || (e.Delta > 0 && sfr.ScaleX < 5.0))
            {
                sfr.ScaleX += (double)e.Delta / 480;
                sfr.ScaleY += (double)e.Delta / 480;
            }
        }

        private void mymap_MouseDown(object sender, MouseButtonEventArgs e)
        {
            isMouseLeftButtonDown = true;
            previousMousePoint = e.GetPosition(mymap);
        }

        private void mymap_MouseMove(object sender, MouseEventArgs e)
        {
            if (isMouseLeftButtonDown)
            {
                Point position = e.GetPosition(mymap);
                tlt.X += position.X - this.previousMousePoint.X;
                tlt.Y += position.Y - this.previousMousePoint.Y;
            }
        }

后面还有 52 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。