• 大小: 16.73MB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2023-07-13
  • 语言: C#
  • 标签:

资源简介

分享网友做的效果很好的winform图片查看器,主要包含拖拽移动缩放,我也是找了很久才找到的。

资源截图

代码片段和文件信息

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  2012-06-23 16:59  Winform图片拖拽移动缩放\
     目录           0  2012-06-23 17:15  Winform图片拖拽移动缩放\ImageMoveZoom\
     文件        3291  2012-06-23 17:28  Winform图片拖拽移动缩放\ImageMoveZoom\Form1.Designer.cs
     文件        1789  2012-06-23 17:28  Winform图片拖拽移动缩放\ImageMoveZoom\Form1.cs
     文件        5817  2012-06-23 17:28  Winform图片拖拽移动缩放\ImageMoveZoom\Form1.resx
     文件        4777  2012-06-23 17:20  Winform图片拖拽移动缩放\ImageMoveZoom\ImageMoveZoom.csproj
     目录           0  2012-06-23 17:15  Winform图片拖拽移动缩放\ImageMoveZoom\Images\
     文件      879394  2012-06-23 17:15  Winform图片拖拽移动缩放\ImageMoveZoom\Images\Chrysanthemum.jpg
     文件      845941  2012-06-23 17:15  Winform图片拖拽移动缩放\ImageMoveZoom\Images\Desert.jpg
     文件      595284  2012-06-23 17:15  Winform图片拖拽移动缩放\ImageMoveZoom\Images\Hydrangeas.jpg
     文件      775702  2012-06-23 17:15  Winform图片拖拽移动缩放\ImageMoveZoom\Images\Jellyfish.jpg
     文件      780831  2012-06-23 17:15  Winform图片拖拽移动缩放\ImageMoveZoom\Images\Koala.jpg
     文件      561276  2012-06-23 17:15  Winform图片拖拽移动缩放\ImageMoveZoom\Images\Lighthouse.jpg
     文件      777835  2012-06-23 17:15  Winform图片拖拽移动缩放\ImageMoveZoom\Images\Penguins.jpg
     文件      620888  2012-06-23 17:15  Winform图片拖拽移动缩放\ImageMoveZoom\Images\Tulips.jpg
     文件        6035  2012-06-23 17:11  Winform图片拖拽移动缩放\ImageMoveZoom\PicViewForm.cs
     文件        3191  2012-06-23 17:11  Winform图片拖拽移动缩放\ImageMoveZoom\PicViewForm.designer.cs
     文件        5817  2012-06-23 17:11  Winform图片拖拽移动缩放\ImageMoveZoom\PicViewForm.resx
     文件         474  2012-06-23 16:59  Winform图片拖拽移动缩放\ImageMoveZoom\Program.cs
     目录           0  2012-06-23 16:59  Winform图片拖拽移动缩放\ImageMoveZoom\Properties\
     文件        1358  2012-06-23 16:59  Winform图片拖拽移动缩放\ImageMoveZoom\Properties\AssemblyInfo.cs
     文件        2876  2012-06-23 16:59  Winform图片拖拽移动缩放\ImageMoveZoom\Properties\Resources.Designer.cs
     文件        5612  2012-06-23 16:59  Winform图片拖拽移动缩放\ImageMoveZoom\Properties\Resources.resx
     文件        1098  2012-06-23 16:59  Winform图片拖拽移动缩放\ImageMoveZoom\Properties\Settings.Designer.cs
     文件         249  2012-06-23 16:59  Winform图片拖拽移动缩放\ImageMoveZoom\Properties\Settings.settings
     目录           0  2012-06-23 17:11  Winform图片拖拽移动缩放\ImageMoveZoom\bin\
     目录           0  2012-06-23 17:34  Winform图片拖拽移动缩放\ImageMoveZoom\bin\Debug\
     文件       13824  2012-06-23 17:34  Winform图片拖拽移动缩放\ImageMoveZoom\bin\Debug\ImageMoveZoom.exe
     文件       28160  2012-06-23 17:34  Winform图片拖拽移动缩放\ImageMoveZoom\bin\Debug\ImageMoveZoom.pdb
     文件       11608  2012-06-23 17:34  Winform图片拖拽移动缩放\ImageMoveZoom\bin\Debug\ImageMoveZoom.vshost.exe
     目录           0  2012-06-23 17:34  Winform图片拖拽移动缩放\ImageMoveZoom\bin\Debug\Images\
............此处省略48个文件信息

评论

共有 条评论

相关资源