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
Ïà¹ØÎĵµ£º
Step 1£ºÐ½¨Êý¾Ý¿â(¿â£ºMyForms £»±í£ºusers £»×ֶΣºID£¬userName, userPwd)£»
Step 2£ºÐ½¨ÍøÕ¾£¬web.config µÄÎļþÈ«²¿´úÂëÈçÏ£º
web.config µÄÈ«²¿´úÂë
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
......
/// <summary>
/// »ñÈ¡QQµ±Ç°×´Ì¬£¨1£ºÔÚÏߣ¬0£º²»ÔÚÏߣ¬-1£º²»´æÔÚ£©
/// </summary>
/// <param name="qq">qqºÅ</param>
/// <returns></returns>
public static int GetQQS ......
×î½ü×öÁËÒ»¸öÏîÄ¿·¢ÏÖ Response.Redirect ºó Session »á¶ªÊ§£¬¸ãÁËÁ½ÌìÖÕÓÚ·¢ÏÖÎÊÌâËùÔÚ¡£
ÎÊÌâ´úÂë
Session["xxx"] = xxx;
Response.Redirect("yyy.aspx");
µ±Ò³ÃæÌø×ªµ½ yyy.aspx £¬ Session ¶ªÊ§£¬·ÃÎÊ Session[“xxx”] µÃµ½ null.
ÔÒò£ºµ±asp.net Ö´ÐÐ Response.Redirect ʱ»á ......
ÈçºÎ°Ñ²Ù×÷µÄÊý¾ÝÌí¼Óµ½Êý¾Ý¿âÖУ¿
н¨´¥·¢Æ÷µÄ·½·¨¼°ÔÀí£¿
½ÌʦÈçºÎÌí¼Ó(Éϱ¨)¿ÎÌ⣬ÊÇ·ñÊÇÓÃEXCEL»òÊÇÆäËûµÄ·½·¨OR add task£¨°üÀ¨ä¯ÀÀ¿ÎÌâ¡¢²éÔÄѧÉúÑ¡ÌâÇé¿ö£©£¿
½ÌʦÉóÉóºËÊÇ·ñͨ¹ý£¿
PLAN:
¸ü¸Ä¸öÈËÐÅÏ¢¡¢ÃÜÂëµÈ
½ÌʦµÇ¼¡¢Éϱ¨¿ÎÌâ ( ¼´ÊÇInsert Óï¾ä)£Û Ìí¼Ó¿ÎÌâ ¡¢¿ÎÌâä¯ÀÀ £Ý
½ÌÊ¦È ......
MVC(¼´Ä£ÐÍ-ÊÓͼ-¿ØÖÆÆ÷)
MVC(Model-View-Controller)ÓÃÓÚ±íʾһÖÖÈí¼þ¼Ü¹¹Ä£Ê½.Ëü°ÑÈí¼þϵͳ·ÖΪÈý¸ö»ù±¾²¿·Ö:Ä£ÐÍ(Model),
ÊÓͼ(View)ºÍ¿ØÖÆÆ÷(Controller)
MVCµÄÓŵ㣺
1¶à¸öÊÓͼ¶ÔÓ¦Ò»¸öÄ£Ð͵ÄÄÜÁ¦
......