日期:2014-05-17 浏览次数:21041 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace ImageScale
{
public partial class Form1 : Form
{
public Form1() {
InitializeComponent();
this.StartPosition = FormStartPosition.CenterScreen;
this.pictureBox1.BorderStyle = BorderStyle.FixedSingle;
this.pictureBox1.BackColor = Color.DarkGray;
this.pictureBox1.MouseWheel += new MouseEventHandler(pictureBox1_MouseWheel);
}
Bitmap m_bmp; //画布中的图像
Point m_ptCanvas; //画布原点在设备上的坐标
Point m_ptCanvasBuf; //重置画布坐标计算时用的临时变量
Point m_ptBmp; //图像位于画布坐标系中的坐标
float m_nScale = 1.0F; //缩放比例
Point m_ptMouseDown; //鼠标点下是在设备坐标上的坐标
string m_strMousePt; //鼠标当前位置对应的坐标
private void Form1_Load(object sender, EventArgs e) {
m_bmp = GetScreen();
//初始化 坐标
m_ptCanvas = new Point(pictureBox1.Width / 2, pictureBox1.Height /&