Views/ImageView.xaml.cs

(开头部分) 9KB

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

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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;

namespace MahAppsMetro.Demo.Views
{
    /// <summary>
    /// Interaction logic for ImageView.xaml
    /// </summary>
    public partial class ImageView : UserControl
    {
        public ImageView()
        {
            InitializeComponent();
        }


        bool mouseDown = false;
        Point prePo;
        private void Img_MouseDown(object sender, MouseButtonEventArgs e)
        {
            mouseDown = true;
            Cursor = Cursors.Hand;
            prePo = e.GetPosition(canvas);
        }


        /// <summary>
        /// 移动图片
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Img_PreviewMouseMove(object sender, MouseEventArgs e)
        {
            Point currentPoint = e.GetPosition(canvas);
            if (mouseDown)
            {
                double left = Canvas.GetLeft(img);
                double top = Canvas.GetTop(img);
                if (currentPoint.X != prePo.X)
                    Canvas.SetLeft(img, left + currentPoint.X - prePo.X);
                if (currentPoint.Y != prePo.Y)
                    Canvas.SetTop(img, top + currentPoint.Y - prePo.Y);
                prePo = currentPoint;
            }
        }

        private void Img_MouseUp(object sender, MouseButtonEventArgs e)
后面还有 222 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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