日期:2013-08-14  浏览次数:20562 次

/*
说明:按照指定大小,生成缩略图
作者:Blue.Dream
*/
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;

namespace test
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
//声明加密字符生成的随机数的位数
public const int LENGTH = 32;
//声明加密字符前后的分隔长度
public const int LEN = 4;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button btn_Browser;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.PictureBox imgSource;
private System.Windows.Forms.PictureBox imgObject;
private string SourceFile;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox local;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
this.Init();

//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}

private void Init()
{
DataTable ht = new DataTable();
DataColumn objcol = new DataColumn("Keys");
objcol.DataType = typeof(System.String);
ht.Columns.Add(objcol);
objcol = new DataColumn("Value");
objcol.DataType = typeof(System.Int32);
ht.Columns.Add(objcol);
DataRow row = ht.NewRow();
row[0] = "800*600";
row[1] = 1;
ht.Rows.Add(row);
row = ht.NewRow();
row[0] = "640*480";
row[1] = 2;
ht.Rows.Add(row);
row = ht.NewRow();
row[0] = "420*360";
row[1] = 3;
ht.Rows.Add(row);
row = ht.NewRow();
row[0] = "340*270";
row[1] = 4;
ht.Rows.Add(row);
row = ht.NewRow();
row[0] = "240*180";
row[1] = 5;
ht.Rows.Add(row);
row = ht.NewRow();
row[0] = "120*90";
row[1] = 6;
ht.Rows.Add(row);


this.local.DataSource = ht;
this.local.DisplayMember = "Keys";
this.local.ValueMember = "Value";
}

/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.imgSource = new System.Windows.Forms.PictureBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.imgObject = new System.Windows.Forms.PictureBox();
this.btn_Browser = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.local = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.imgSource});
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(288, 296);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;