91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡(jiǎn)介

☆ 功能如下:☆ 商品瀏覽; 商品信息查看; 繼續(xù)購(gòu)物、結(jié)賬、清空購(gòu)物車等; 商品后臺(tái)管理;

資源截圖

代碼片段和文件信息

using?System;
using?System.Drawing;
using?System.Drawing.Drawing2D;
using?System.Drawing.Imaging;
using?System.IO;
using?System.Web;
using?System.Web.UI;

public?partial?class?CheckCode?:?Page
{
????protected?void?Page_Load(object?sender?EventArgs?e)
????{
????????CreateCheckCodeImage(GenerateCheckCode());
????}

????private?string?GenerateCheckCode()
????{
????????int?number;
????????char?code;
????????string?checkCode?=?String.Empty;

????????Random?random?=?new?Random();

????????for?(int?i?=?0;?i?????????{
????????????number?=?random.Next();
????????????code?=?(char)?(‘0‘?+?(char)?(number%10));
????????????checkCode?+=?code.ToString();
????????}
????????Response.Cookies.Add(new?HttpCookie(“CheckCode“?checkCode));
????????return?checkCode;
????}

????private?void?CreateCheckCodeImage(string?checkCode)
????{
????????if?(String.IsNullOrEmpty(checkCode))
????????{
????????????return;
????????}
????????Bitmap?bitmap?=?new?Bitmap((int)?Math.Ceiling((checkCode.Length*12.5))?22);
????????Graphics?graphics?=?Graphics.FromImage(bitmap);
????????try
????????{
????????????//?生成隨機(jī)生成器
????????????Random?random?=?new?Random();

????????????//?清空?qǐng)D片背景色
????????????graphics.Clear(Color.White);

????????????//?畫圖片的背景噪音線
????????????for?(int?i?=?0;?i?????????????{
????????????????int?x1?=?random.Next(bitmap.Width);
????????????????int?x2?=?random.Next(bitmap.Width);
????????????????int?y1?=?random.Next(bitmap.Height);
????????????????int?y2?=?random.Next(bitmap.Height);
????????????????graphics.DrawLine(new?Pen(Color.Black)?x1?y1?x2?y2);
????????????}

????????????Font?font?=?new?Font(“Arial“?12?(Fontstyle.Bold));
????????????LinearGradientBrush?brush?=?new?LinearGradientBrush(new?Rectangle(0?0?bitmap.Width?bitmap.Height)
????????????????????????????????????????????????????????????????Color.Blue?Color.DarkRed?1.2f?true);
????????????graphics.DrawString(checkCode?font?brush?2?2);

????????????//?畫圖片的前景噪音點(diǎn)
????????????for?(int?i?=?0;?i?????????????{
????????????????int?x?=?random.Next(bitmap.Width);
????????????????int?y?=?random.Next(bitmap.Height);
????????????????bitmap.SetPixel(x?y?Color.FromArgb(random.Next()));
????????????}

????????????//?畫圖片的邊框線
????????????graphics.DrawRectangle(new?Pen(Color.Silver)?0?0?bitmap.Width?-?1?bitmap.Height?-?1);
????????????MemoryStream?ms?=?new?MemoryStream();
????????????bitmap.Save(ms?ImageFormat.Gif);
????????????Response.ClearContent();
????????????Response.ContentType?=?“image/Gif“;
????????????Response.BinaryWrite(ms.ToArray());
????????}
????????finally
????????{
????????????graphics.Dispose();
????????????bitmap.Dispose();
????????}
????}
}

評(píng)論

共有 條評(píng)論