using System;//来源于www.uzhanbao.com
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
namespace ImageLoader
{
public partial class Form1 : Form
{
private Rectangle selectedArea;
private Image loadedImage;
private Color selectionColor;
private int count = 10;
public Form1()
{
InitializeComponent();
this.MouseWheel +=new MouseEventHandler(picBox1_MouseWheel);
picBox1.SizeMode = PictureBoxSizeMode.Zoom;
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
if (loadedImage != null)
{
loadedImage.Dispose();
}
try
{
loadedImage = Image.FromFile(openFileDialog1.FileName);
//Get a contrasting color for the image selection marker
using (Bitmap bmp = new Bitmap(loadedImage))
{
selectionColor = GetDominantColor(bmp, false);
selectionColor = CalculateOppositeColor(selectionColor);
}
///tZoom.Value = 1;
//resizePictureArea();
//Map the area selected in the thumbail to the actual image size
Rectangle zoomArea = new Rectangle();
Rectangle l
C#(winform)实现图片的无损放大缩小【点击鼠标滚动键放大缩小】
最新推荐文章于 2024-04-25 13:38:05 发布