原帖在这里:http://bbs.mjtd.com/thread-89016-1-1.html
当批量获取缩略图时程序自动终止,请教作者应该如何使用?
代码在这里:
这是主程序文件
-
- 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 chmenf087.Att.Components.Shell;
- using System.IO;
- namespace Test_chmenf087
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- ThumbnailCreater tb = new ThumbnailCreater();
- Bitmap[] btms = null;
- private void button1_Click(object sender, EventArgs e)
- {
- FolderBrowserDialog fd = new FolderBrowserDialog();
- fd.RootFolder = Environment.SpecialFolder.MyComputer;
- if (fd.ShowDialog() == DialogResult.OK)
- {
- string[] dirs = Directory.GetFiles(fd.SelectedPath, "*.dwg");
- tb.DesireSize = new Size(30, 30);
- tb.ReversBlackWhite = true;
- btms[0] =tb. GetThumbNail(dirs[0]);
- pictureBox1.Image = btms[0];
- btms[1] = tb.GetThumbNail(dirs[1]);
- pictureBox2.Image = btms[1];
- btms[2] = tb.GetThumbNail(dirs[2]);
- pictureBox3.Image = btms[2];
- btms[3] = tb.GetThumbNail(dirs[3]);
- pictureBox4.Image = btms[3];
-
- }
- }
- }
|