• 大小: 1.35M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-14
  • 语言: C#
  • 标签: 图片  C#  PictureBox  

资源简介

用多个picturebox实现一次读入多张图片

 private void 打开NToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog opnDlg = new OpenFileDialog();
            opnDlg.Filter = "All Image files|*.bmp;*.jpf;*.jpg;*.ico;*.tif;" "*.emf;*.wmf|Bitmap Files(*.bmp;*.gif;*.jpg;" "*.ico)|*.bmp;*.gif;*.jpg;*.ico|" "Meta Files(*.emf;*.wmf;*.png)|*.emf;*wmf;*.png";
            opnDlg.Title = "ImageViewer: Open Image File";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                curFileName= opnDlg.FileName;
                pictureBox1.Image = Image.FromFile(openFileDialog1.FileNames[0]);
                pictureBox2.Image = Image.FromFile(openFileDialog1.FileNames[1]);
                pictureBox3.Image = Image.FromFile(openFileDialog1.FileNames[2]);
            }

        }

资源截图

代码片段和文件信息

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

namespace PictureBoxShowImage
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                pictureBox1.Image = Image.FromFile(openFileDialog1.FileName);
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-04-27 15:53  PictureBox显示图片\
     目录           0  2017-04-25 20:56  PictureBox显示图片\.vs\
     目录           0  2017-04-11 18:09  PictureBox显示图片\.vs\PictureBoxShowImage\
     目录           0  2017-04-11 18:09  PictureBox显示图片\.vs\PictureBoxShowImage\v14\
     文件       45568  2017-04-25 21:28  PictureBox显示图片\.vs\PictureBoxShowImage\v14\.suo
     目录           0  2017-04-25 20:56  PictureBox显示图片\.vs\config\
     文件       83003  2016-06-01 10:04  PictureBox显示图片\.vs\config\applicationhost.config
     目录           0  2017-04-11 18:09  PictureBox显示图片\Backup\
     目录           0  2017-04-11 18:09  PictureBox显示图片\Backup\PictureBoxShowImage\
     文件        3135  2009-02-07 09:22  PictureBox显示图片\Backup\PictureBoxShowImage\Form1.Designer.cs
     文件         632  2009-02-07 09:22  PictureBox显示图片\Backup\PictureBoxShowImage\Form1.cs
     文件        6017  2009-02-07 09:22  PictureBox显示图片\Backup\PictureBoxShowImage\Form1.resx
     文件        3784  2009-02-07 09:22  PictureBox显示图片\Backup\PictureBoxShowImage\PictureBoxShowImage.csproj
     文件         500  2009-02-07 09:20  PictureBox显示图片\Backup\PictureBoxShowImage\Program.cs
     目录           0  2017-04-11 18:09  PictureBox显示图片\Backup\PictureBoxShowImage\Properties\
     文件        1370  2009-02-07 09:20  PictureBox显示图片\Backup\PictureBoxShowImage\Properties\AssemblyInfo.cs
     文件        2888  2009-02-07 09:20  PictureBox显示图片\Backup\PictureBoxShowImage\Properties\Resources.Designer.cs
     文件        5612  2009-02-07 09:20  PictureBox显示图片\Backup\PictureBoxShowImage\Properties\Resources.resx
     文件        1104  2009-02-07 09:20  PictureBox显示图片\Backup\PictureBoxShowImage\Properties\Settings.Designer.cs
     文件         249  2009-02-07 09:20  PictureBox显示图片\Backup\PictureBoxShowImage\Properties\Settings.settings
     文件         947  2009-02-07 09:20  PictureBox显示图片\Backup\PictureBoxShowImage.sln
     目录           0  2017-04-27 15:48  PictureBox显示图片\PictureBoxShowImage\
     文件        9630  2017-04-24 15:33  PictureBox显示图片\PictureBoxShowImage\Form1.Designer.cs
     文件        3372  2017-04-27 15:48  PictureBox显示图片\PictureBoxShowImage\Form1.cs
     文件       32321  2017-04-24 15:33  PictureBox显示图片\PictureBoxShowImage\Form1.resx
     文件        3974  2017-04-11 18:09  PictureBox显示图片\PictureBoxShowImage\PictureBoxShowImage.csproj
     文件         500  2009-02-07 09:20  PictureBox显示图片\PictureBoxShowImage\Program.cs
     目录           0  2017-04-11 18:07  PictureBox显示图片\PictureBoxShowImage\Properties\
     文件        1370  2009-02-07 09:20  PictureBox显示图片\PictureBoxShowImage\Properties\AssemblyInfo.cs
     文件        2878  2017-04-11 18:09  PictureBox显示图片\PictureBoxShowImage\Properties\Resources.Designer.cs
     文件        5612  2009-02-07 09:20  PictureBox显示图片\PictureBoxShowImage\Properties\Resources.resx
............此处省略50个文件信息

评论

共有 条评论