为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

图片查看器

2017-09-20 6页 doc 22KB 47阅读

用户头像

is_842972

暂无简介

举报
图片查看器图片查看器 一个图片查看器 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; using System.IO; using System.Media; namespace windows1 ...
图片查看器
图片查看器 一个图片查看器 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; using System.IO; using System.Media; namespace windows1 { public partial class Form1 : Form { private int count = 0; private string strPath; SoundPlayer sp; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.comboBox1.SelectedIndex = 0; } private void groupBox2_Enter(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.RootFolder = Environment.SpecialFolder.Desktop; string strfilename = ""; string strExtfilename = ""; if (fbd.ShowDialog() ==DialogResult.OK) { this.listBox1.Items.Clear(); strPath = fbd.SelectedPath; string[] filenames = Directory.GetFiles(fbd.SelectedPath); for (int i = 0; i < filenames.Length; i++) { strfilename = filenames[i].Substring(filenames[i].LastIndexOf("\\")+1); strExtfilename = filenames[i].Substring(filenames[i].LastIndexOf(".")); if (strExtfilename.ToLower() == ".jpg" || strExtfilename.ToLower() == ".gif") { this.listBox1.Items.Add(strfilename); } } } } private void timer1_Tick(object sender, EventArgs e) { if (this.listBox1.Items.Count > 0) { if (count >= this.listBox1.Items.Count) { count = 0; } this.listBox1.SelectedIndex = count; if (this.pictureBox1.Image != null) { this.pictureBox1.Image.Dispose(); } this.pictureBox1.Image = Image.FromFile(strPath + "\\"+this.listBox1.Items[count]); count++; } } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { count = this.listBox1.SelectedIndex; } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { this.timer1.Interval = (this.comboBox1.SelectedIndex + 1) * 500; } private void pictureBox1_Click(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { if (count > 0) { if (this.button2.Text == "暂停") { this.timer1.Stop(); this.button2.Text = "继续"; } else { this.timer1.Start(); this.button2.Text = "暂停"; } } } private void button4_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "*.wav|*.wav"; if (ofd.ShowDialog() == DialogResult.OK) { if (sp != null) { sp.Dispose(); } sp = new SoundPlayer(ofd.FileName); sp.PlayLooping(); } } private void button3_Click(object sender, EventArgs e) { if (sp != null) { if (this.button3.Text == "停止播放") { sp.Stop(); this.button3.Text = "启动播放"; } else { sp.PlayLooping(); this.button3.Text = "停止播放"; } } } private void groupBox1_Enter(object sender, EventArgs e) { } } }
/
本文档为【图片查看器】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索