日期:2014-05-17  浏览次数:21096 次

【急】如何做到焦点缩放图片!在线等待!
    我想做到鼠标放在那里,它就在哪里缩放。现在的要求还没有达到。我想的是在缩放的时候同时执行图片的移动事件,但是不知道改杂么做了,还请各位看看,帮忙解决一下,谢谢各位了~哪位大哥先解决了这个问题,分就给他了,不多,但是心意哈~

控件源码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;

namespace PictureView
{
    public partial class pictureView : UserControl
    {
        private float _zoomScale;
        private Point _startPoint, _endPoint;
        private bool _isDown;
        private bool _isLoadBmp;
        private Bitmap _currBmp;

        public pictureView()
        {
            InitializeComponent();

            this.MouseWheel += new MouseEventHandler(panel1_MouseWheel);
            this.MouseEnter += new EventHandler(panel1_MouseEnter);
        }

        private void pictureView_Load(object sender, EventArgs e)
        {
            SetStyle(ControlStyles.UserPaint, true);
            //防止窗口跳动
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            //防止控件跳动 
            SetStyle(ControlStyles.DoubleBuffer, true);

            _isLoadBmp = false;
            _isDown = false;
            _zoomScale = 1.0f;
            _startPoint = new Point(0, 0);
            _endPoint = new Point(0, 0);
        }

        public void panel1_MouseEnter(object sender, EventArgs e)
        {
            this.pictureBox1.Focus();
        }

        /// <summary>
        ///  处理鼠标滚动事件
        /// </summary>
        /// <param name="sender"></param>
        ///&n