• 大小: 637KB
    文件类型: .zip
    金币: 2
    下载: 2 次
    发布日期: 2021-04-09
  • 语言: C#
  • 标签: C#,  WinForm  

资源简介

C# 写的图片查看器,实现了图片的放大缩小旋转,等功能,是用来练手的必备参考代码

资源截图

代码片段和文件信息

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;
using System.Drawing.Imaging;

namespace MyImageManger
{
    public partial class frmMain : Form
    {
        //变量——用来存放图片的路径
        string filename;
        /// 
        /// 构造函数
        /// 

        public frmMain()
        {
            InitializeComponent();
            //加载皮肤_WindowsXP蓝色风格
            this.skinEngine1.SkinFile = “XPBlue.ssk“;
        }
        /// 
        /// 打开图片事件  Ctrl+O 快捷键
        /// 

        /// 
        /// 
        private void 打开ToolStripMenuItem_Click(object sender EventArgs e)
        {
            try
            {
                //打开文件对话框
                OpenFileDialog file = new OpenFileDialog();
                //可选的类型
                file.Filter = “*.*|*.*|*.bmp|*.bmp|GIF files (*.GIF)|*.gif|JPG file(*.JPG)|*.JPG|Icon files(*.ico)|*.ico|Png files(*.png)|*.png“;
                //如果用户点确定则加载图片
                if (file.ShowDialog() == DialogResult.OK)
                {
                    //获取本文件夹下的所有图片
                    ImageManager.GetALLFile(file.FileName);
                    this.OpenFile(file.FileName);
                    
                }
            }
            catch
            {
                //如果触发异常捕获,那么肯定是格式不正确
                MessageBox.Show(“您选择的格式此软件无法打开,请确定您所打开的是否为图片““错误提示“MessageBoxButtons.OKMessageBoxIcon.Error);
            }
        }

        private void frmMain_Load(object sender EventArgs e)
        {

        }
        /// 
        /// 放大方法
        /// 

        /// 
        /// 
        private void tsbtnBig_Click(object sender EventArgs e)
        {
            this.Bigger();
            ImgLocation();
        }
        /// 
        /// 缩小方法
        /// 

        /// 
        /// 
        private void tsBtnSmall_Click(object sender EventArgs e)
        {
            Smaller();
            ImgLocation();
        }
        /// 
        /// 顺时针90旋转
        /// 

        /// 
        /// 
        private void tsbtnRight_Click(object sender EventArgs e)
        {
            ToRight();
            ImgLocation();
        }
        /// 
        /// 逆时针90度旋转
        /// 

        /// 
        /// 
        private void tsBtnLeft_Click(object sender EventArgs e)
        {
            ToLeft();
            ImgLocation();
        }
        /// 
        /// 删除方法
        /// 

        /// 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-04-25 21:19  PictureManger\
     目录           0  2010-07-10 22:17  PictureManger\MyImageManger\
     目录           0  2010-07-10 22:17  PictureManger\MyImageManger\bin\
     目录           0  2010-07-10 22:17  PictureManger\MyImageManger\bin\Debug\
     文件       15360  2010-04-25 16:19  PictureManger\MyImageManger\bin\Debug\GifImageLib.dll
     文件      516096  2006-08-18 11:50  PictureManger\MyImageManger\bin\Debug\IrisSkin2.dll
     文件      110592  2011-04-26 11:16  PictureManger\MyImageManger\bin\Debug\MyImageManger.exe
     文件       44544  2011-04-26 11:16  PictureManger\MyImageManger\bin\Debug\MyImageManger.pdb
     文件       11608  2011-04-26 10:59  PictureManger\MyImageManger\bin\Debug\MyImageManger.vshost.exe
     文件         490  2010-03-17 22:39  PictureManger\MyImageManger\bin\Debug\MyImageManger.vshost.exe.manifest
     文件       13189  2010-04-23 14:19  PictureManger\MyImageManger\bin\Debug\XPBlue.ssk
     目录           0  2011-04-25 21:19  PictureManger\MyImageManger\bin\Release\
     文件       13770  2011-04-26 20:53  PictureManger\MyImageManger\frmMain.cs
     文件       18637  2011-04-26 20:53  PictureManger\MyImageManger\frmMain.Designer.cs
     文件      140377  2011-04-26 20:53  PictureManger\MyImageManger\frmMain.resx
     文件        6725  2010-04-25 16:27  PictureManger\MyImageManger\ImageManager.cs
     目录           0  2010-07-10 22:17  PictureManger\MyImageManger\images\
     文件         764  2010-04-23 15:23  PictureManger\MyImageManger\images\Biger.png
     文件         703  2010-04-23 15:19  PictureManger\MyImageManger\images\left.png
     文件         678  2010-04-25 14:12  PictureManger\MyImageManger\images\Next.png
     文件       83560  2010-04-23 16:23  PictureManger\MyImageManger\images\pictures.ico
     文件         723  2010-04-25 14:13  PictureManger\MyImageManger\images\pre.png
     文件         780  2010-04-23 15:19  PictureManger\MyImageManger\images\right.png
     文件         978  2010-04-23 15:24  PictureManger\MyImageManger\images\smaller.png
     文件        4547  2011-04-25 21:19  PictureManger\MyImageManger\MyImageManger.csproj
     文件         208  2011-04-25 21:19  PictureManger\MyImageManger\MyImageManger.csproj.user
     目录           0  2010-07-10 22:17  PictureManger\MyImageManger\obj\
     目录           0  2010-07-10 22:17  PictureManger\MyImageManger\obj\Debug\
     文件        5878  2011-04-26 10:42  PictureManger\MyImageManger\obj\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6474  2011-04-26 11:16  PictureManger\MyImageManger\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         450  2011-04-26 11:16  PictureManger\MyImageManger\obj\Debug\GenerateResource-ResGen.read.1.tlog
............此处省略21个文件信息

评论

共有 条评论