ASP.NET(C#)ͼƬÉÏ´«Ñ¹Ëõ³ÉËõÂÔͼµÄ´úÂë
// °´Ä£°æ±ÈÀýÉú³ÉËõÂÔͼ£¨ÒÔÁ÷µÄ·½Ê½»ñÈ¡Ô´Îļþ£©
//Éú³ÉËõÂÔͼº¯Êý
//˳Ðò²ÎÊý£ºÔ´Í¼ÎļþÁ÷¡¢ËõÂÔͼ´æ·ÅµØÖ·¡¢Ä£°æ¿í¡¢Ä£°æ¸ß
//×¢£ºËõÂÔͼ´óС¿ØÖÆÔÚÄ£°æÇøÓòÄÚ
public static void MakeSmallImg(System.IO.Stream fromFileStream,string fileSaveUrl,System.Double templateWidth,System.Double templateHeight)
{
//´ÓÎļþÈ¡µÃͼƬ¶ÔÏ󣬲¢Ê¹ÓÃÁ÷ÖÐǶÈëµÄÑÕÉ«¹ÜÀíÐÅÏ¢
System.Drawing.Image myImage = System.Drawing.Image.fromStream(fromFileStream,true);
//ËõÂÔͼ¿í¡¢¸ß
System.Double newWidth = myImage.Width , newHeight = myImage.Height;
//¿í´óÓÚÄ£°æµÄºáͼ
if(myImage.Width>myImage.Height || myImage.Width==myImage.Height)
{
if(myImage.Width > templateWidth)
{
//¿í°´Ä£°æ£¬¸ß°´±ÈÀýËõ·Å
newWidth = templateWidth;
newHeight = myImage.Height * (newWidth/myImage.Width);
}
}
//¸ß´óÓÚÄ£°æµÄÊúͼ
else
{
if(myImage.Height > templateHeight)
{
//¸ß°´Ä£°æ£¬¿í°´±ÈÀýËõ·Å
newHeight = templateHeight;
newWidth = myImage.Width * (newHeight/myImage.Height);
}
}
//È¡µÃͼƬ´óС
System.Drawing.Size mySize = new Size((int)newWidth,(int)newHeight);
//н¨Ò»¸öbmpͼƬ
System.Drawing.Image bitmap = new System.Drawing.Bitmap(mySize.Width,mySize.Height);
//н¨Ò»¸ö»°å
System.Drawing.Graphics g = System.Drawing.Graphics.fromImage(bitmap);
//ÉèÖøßÖÊÁ¿²åÖµ·¨
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
//ÉèÖøßÖÊÁ¿,µÍËٶȳÊÏÖƽ»¬³Ì¶È
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
//Çå¿Õһϻ²¼
g.Clear(Color.White);
//ÔÚÖ¸¶¨Î»Öûͼ
g.DrawImage(myImage , new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height) ,
new System.Drawing.Rectangle(0, 0, myImage.Width,myImage.Height) ,
System.Drawing.GraphicsUnit.Pixel);
///ÎÄ×Öˮӡ
//System.Drawing.Graphics G=System.Drawing.Graphics.fromImage(bitmap);
//System.Drawing.Font f=new Font("ËÎÌå",10);
//System.Drawing.Brush b=new SolidBrush(Color.Black);
//G.DrawString("myohmine",f,b,10,10);
//G.Dispose();
///ͼƬˮӡ
//System.Drawing.Image copyImage = System.Drawing.Imag
Ïà¹ØÎĵµ£º
×î½ü×öÁËÒ»¸öÏîÄ¿·¢ÏÖ Response.Redirect ºó Session »á¶ªÊ§£¬¸ãÁËÁ½ÌìÖÕÓÚ·¢ÏÖÎÊÌâËùÔÚ¡£
ÎÊÌâ´úÂë
Session["xxx"] = xxx;
Response.Redirect("yyy.aspx");
µ±Ò³ÃæÌøתµ½ yyy.aspx £¬ Session ¶ªÊ§£¬·ÃÎÊ Session[“xxx”] µÃµ½ null.
ÔÒò£ºµ±asp.net Ö´ÐÐ Response.Redirect ʱ»á ......
ÕâÊÇ΢ÈíµÄÒ»¸öBug,¿ÉÒÔÈ¥¹ÙÍøÏÂÔØÒ»¸öValidators.dll,ÒýÓõ½ÄãµÄÏîÄ¿ÏÂ,È»ºóÔÚWeb.ConfigÀïconfiguration/system.web/pages½ÚµãÖÐÌí¼Ó£¨»òÐ޸ģ©ÈçϵÄÔªËØ:
<pages>
<tagMapping>
<add tagType="System.Web.UI.Web ......
MVC(¼´Ä£ÐÍ-ÊÓͼ-¿ØÖÆÆ÷)
MVC(Model-View-Controller)ÓÃÓÚ±íʾһÖÖÈí¼þ¼Ü¹¹Ä£Ê½.Ëü°ÑÈí¼þϵͳ·ÖΪÈý¸ö»ù±¾²¿·Ö:Ä£ÐÍ(Model),
ÊÓͼ(View)ºÍ¿ØÖÆÆ÷(Controller)
MVCµÄÓŵ㣺
1¶à¸öÊÓͼ¶ÔÓ¦Ò»¸öÄ£Ð͵ÄÄÜÁ¦
......
¿Éͨ¹ý½« XmlDataSource ¿Ø¼þµÄ XPath ÊôÐÔÉèÖÃΪ XPath ɸѡ±í´ïʽ£¬À´É¸Ñ¡¸Ã¿Ø¼þ¹«¿ªµÄ XML Êý¾Ý¡£Èç¹ûÒÑÖ¸¶¨¿ÉÀ©Õ¹Ñùʽ±íÓïÑÔ (XSL) Ñùʽ±íÀ´×ª»» XmlDataSource ¿Ø¼þ¹«¿ªµÄÊý¾Ý£¬ÔòÔÚת»»ºó»áÓ¦Óà XPath ɸѡ±í´ïʽ¡£
ÏÂÃæµÄ´úÂëʾÀýÑÝʾ°ó¶¨µ½ TreeView ¿Ø¼þµÄ XmlDataSource ¿Ø¼þ¡ ......