ÔÚASP.NETÖÐÉÏ´«Í¼Æ¬²¢Éú³ÉËõÂÔͼµÄC#Ô´Âë
http://www.knowsky.com/5723.html
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Drawing.Imaging;
namespace eMeng.Exam
{
/// <summary>
/// Thumbnail µÄժҪ˵Ã÷¡£
/// </summary>
public class Thumbnail : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
// ÔÚ´Ë´¦·ÅÖÃÓû§´úÂëÒÔ³õʼ»¯Ò³Ãæ
Label1.Text = "<h3>ÔÚASP.NETÀïÇáËÉʵÖËõÂÔÍ?lt;/h3>";
Button1.Text = "ÉÏÔز¢ÏÔʾËõÂÔͼ";
}
#region Web ´°ÌåÉè¼ÆÆ÷Éú³ÉµÄ´úÂë
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: ¸Ãµ÷ÓÃÊÇ ASP.NET Web ´°ÌåÉè¼ÆÆ÷Ëù±ØÐèµÄ¡£
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Éè¼ÆÆ÷Ö§³ÖËùÐèµÄ·½·¨ - ²»ÒªÊ¹ÓôúÂë±à¼Æ÷ÐÞ¸Ä
/// ´Ë·½·¨µÄÄÚÈÝ¡£
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
HttpFileCollection MyFileColl = HttpContext.Current.Request.Files;
HttpPostedFile MyPostedFile = MyFileColl[0];
if (MyPostedFile.ContentType.ToString().ToLower().IndexOf("image") < 0)
{
Response.Write("ÎÞЧµÄͼÐθñʽ¡£");
return;
}
GetThumbNail(MyPostedFile.FileName, 100, 100,
MyPostedFile.ContentType.ToString(), false, MyPostedFile.InputStream);
}
private System.Drawing.Imaging.ImageFormat GetImageType(object strContentType)
{
if ((strContentType.ToString().ToLower()) == "image/pjpeg")
{
return System.Drawing.Imaging.ImageFormat.Jp
Ïà¹ØÎĵµ£º
ÈÎÖ°×ʸñ:
1. ´óѧ±¾¿ÆÒÔÉÏѧÀú£¬ÈýÄêÒÔÉÏÈí¼þ¿ª·¢¹¤×÷¾Ñé»ò»¥ÁªÍø¿ª·¢¾Ñ飻¾ßÓжþ¸ö¼°ÒÔÉÏÖÐÐÍÏîÄ¿µÄ³É¹¦ÊµÊ©¾Ñ飻
2. ÓÐ׼ȷÀí½âÐèÇ󡢼ܹ¹ÄÜÁ¦£¬ÓнÏÇ¿µÄ³ÌÐòÉè¼ÆÄÜÁ¦, ÊìϤÃæÏò¶ÔÏó·ÖÎö¡¢Èí¼þ¹¤³Ì¡¢UMLµÈÏà¹Ø¼¼Êõ£»
3. ÊìÁ·ÕÆÎÕ¼ÆËã»ú±à³ÌÒ»°ã˼ÏëºÍ·½·¨£»ÊìϤһÖÁÁ½ÖÖÃæÏò¶ÔÏó±à³ÌÓïÑÔ£»¾«Í¨.NET¡¢ C#¡¢ASP.net¡ ......
½«ViewState³Ö¾Ã»¯±£³ÖÔÚ·þÎñÆ÷¶ËÎļþµÄ´úÂ룬ÕâÑùViewState²»Õ¼ÓÃÍøÂç´ø¿í£¬Òò´ËÆä´æÈ¡Ö»ÊÇ·þÎñÆ÷µÄ´ÅÅ̶Áȡʱ¼ä¡£²¢ÇÒËüºÜС£¬¿ÉÒÔ˵ÊÇ´ÅÅÌËæ±ãתһȦ¾ÍÄÜͬʱ¶ÁÈ¡ºÃ¶àViewState£¬Òò´Ë¿ÉÒÔ˵“²»Õ¼Ê±¼ä”¡£ÎªÁËÔÙ“²»Õ¼´ÅÅÌʱ¼ä”£¬ÎÒ»¹Ê¹ÓÃÁË»º´æ¡£
´´½¨Ò»¸ö»ùÀà:
public class
BasePage : Sys ......
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using ......