• 大小: 18.31MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-02
  • 语言: C#
  • 标签: 图片预览  

资源简介

类似qq图片预览功能,放大缩小焦点会等比例调整,代码中有详细的算法

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace ImageMoveZoom
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        ImageList imageList1 = new ImageList();
        private void Form1_Load(object sender EventArgs e)
        {
            imageList1.ImageSize = new System.Drawing.Size(120 120);
            this.listView1.LargeImageList = imageList1;
            DirectoryInfo diImg = new DirectoryInfo(Application.StartupPath + “\\Images“);
            foreach (FileInfo fi in diImg.GetFiles())
            {
                Image img = Image.FromFile(fi.FullName);
                imageList1.Images.Add(fi.Name img);
            }
            for (int i=0; i            {
                ListViewItem lvi = new ListViewItem(new string[] { imageList1.Images.Keys[i] });
                lvi.ImageKey = imageList1.Images.Keys[i];
                this.listView1.Items.Add(lvi);
            }
        }

        private void listView1_MouseDoubleClick(object sender MouseEventArgs e)
        {
            if (this.listView1.SelectedItems.Count > 0)
            {
                ListViewItem lvi = this.listView1.SelectedItems[0];
                string key = lvi.SubItems[0].Text.ToString();
                PicViewForm pvf = new PicViewForm();
                Image img = Image.FromFile(Application.StartupPath + “\\Images\\“ + key);
                pvf.InPutBuffer(img);
                pvf.Text += “ - “ + key;
                pvf.ShowDialog();
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-09-08 12:04  图片浏览-放大缩小\
     目录           0  2017-09-08 12:04  图片浏览-放大缩小\ImageMoveZoom\
     目录           0  2017-09-08 12:04  图片浏览-放大缩小\ImageMoveZoom\DLL\
     文件     2245120  2015-03-10 22:12  图片浏览-放大缩小\ImageMoveZoom\DLL\CSkin.dll
     文件        3291  2012-06-23 17:28  图片浏览-放大缩小\ImageMoveZoom\Form1.Designer.cs
     文件        1789  2012-06-23 17:28  图片浏览-放大缩小\ImageMoveZoom\Form1.cs
     文件        5817  2012-06-23 17:28  图片浏览-放大缩小\ImageMoveZoom\Form1.resx
     文件        4777  2012-06-23 17:20  图片浏览-放大缩小\ImageMoveZoom\ImageMoveZoom.csproj
     文件         227  2015-06-08 10:26  图片浏览-放大缩小\ImageMoveZoom\ImageMoveZoom.csproj.user
     目录           0  2017-09-08 12:04  图片浏览-放大缩小\ImageMoveZoom\Images\
     文件      879394  2012-06-23 17:15  图片浏览-放大缩小\ImageMoveZoom\Images\Chrysanthemum.jpg
     文件      845941  2012-06-23 17:15  图片浏览-放大缩小\ImageMoveZoom\Images\Desert.jpg
     文件      595284  2012-06-23 17:15  图片浏览-放大缩小\ImageMoveZoom\Images\Hydrangeas.jpg
     文件      775702  2012-06-23 17:15  图片浏览-放大缩小\ImageMoveZoom\Images\Jellyfish.jpg
     文件      780831  2012-06-23 17:15  图片浏览-放大缩小\ImageMoveZoom\Images\Koala.jpg
     文件      561276  2012-06-23 17:15  图片浏览-放大缩小\ImageMoveZoom\Images\Lighthouse.jpg
     文件      777835  2012-06-23 17:15  图片浏览-放大缩小\ImageMoveZoom\Images\Penguins.jpg
     文件      620888  2012-06-23 17:15  图片浏览-放大缩小\ImageMoveZoom\Images\Tulips.jpg
     文件        6062  2015-06-08 08:32  图片浏览-放大缩小\ImageMoveZoom\PicViewForm.cs
     文件        3194  2015-06-08 08:32  图片浏览-放大缩小\ImageMoveZoom\PicViewForm.designer.cs
     文件        5817  2015-06-08 08:32  图片浏览-放大缩小\ImageMoveZoom\PicViewForm.resx
     文件         474  2012-06-23 16:59  图片浏览-放大缩小\ImageMoveZoom\Program.cs
     目录           0  2017-09-08 12:04  图片浏览-放大缩小\ImageMoveZoom\Properties\
     文件        1358  2012-06-23 16:59  图片浏览-放大缩小\ImageMoveZoom\Properties\AssemblyInfo.cs
     文件        2876  2012-06-23 16:59  图片浏览-放大缩小\ImageMoveZoom\Properties\Resources.Designer.cs
     文件        5612  2012-06-23 16:59  图片浏览-放大缩小\ImageMoveZoom\Properties\Resources.resx
     文件        1098  2012-06-23 16:59  图片浏览-放大缩小\ImageMoveZoom\Properties\Settings.Designer.cs
     文件         249  2012-06-23 16:59  图片浏览-放大缩小\ImageMoveZoom\Properties\Settings.settings
     目录           0  2017-09-08 12:04  图片浏览-放大缩小\ImageMoveZoom\bin\
     目录           0  2017-09-08 12:04  图片浏览-放大缩小\ImageMoveZoom\bin\Debug\
     文件       14336  2017-10-27 15:38  图片浏览-放大缩小\ImageMoveZoom\bin\Debug\ImageMoveZoom.exe
............此处省略55个文件信息

评论

共有 条评论