日期:2014-05-17 浏览次数:21203 次
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