欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
動(dòng)態(tài)生成驗證碼&計數器圖片 - mengyao||Andy 路鑫 Dotnet World...
網(wǎng)上常能看到很多制作精美的計數器,很多效果都看上去很酷,但是這些圖片往往是一張完整的圖片而不是一系列數字圖片的展現。如何用ASP.net實(shí)現動(dòng)態(tài)生成這樣一張計數器圖片呢?

步驟如下:
1 制作數字0~9的小圖片,可以制作多種風(fēng)格的
2 每種風(fēng)格的圖片放在一個(gè)文件夾里
3 使用Graphics類(lèi)將這些圖片合成最后輸出的圖片
4 利用Bitmap保存圖片,并以圖片流形式輸出 

測試工程截圖:


代碼如下:
這個(gè)頁(yè)面也是沒(méi)有前臺的,所以只需要寫(xiě)入后臺C#代碼

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.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
//made by hekui 20070212
public partial class Count : System.Web.UI.Page
{
    
protected void Page_Load(object sender, EventArgs e)
    
{
        
string strCount = string.Empty;
        
string strStyle = string.Empty;

        
if (Request.QueryString["count"!= null)
        
{
            strCount 
= Request.QueryString["count"].ToString();
        }


        
if (Request.QueryString["style"!= null)
        
{
            strStyle 
= Request.QueryString["style"].ToString();
        }

        
else
        
{
            strStyle 
= "number1";
        }


        
//生成COUNT圖片
        SetCountIMG(strCount, strStyle);
    }


    
//生成COUNT圖片
    private void SetCountIMG( string strCount,string strStyle )
    
{
        
//定義輸出位圖
        Bitmap bmp = new Bitmap(300,100);
        
//定義繪圖對象
        Graphics g = Graphics.FromImage(bmp);
        
//描述矩形區域 
        Rectangle newRect = new Rectangle(00300100);
        
//設置背景色
        g.FillRectangle(new SolidBrush(Color.White), newRect);
        
        
int intLength = strCount.Length;
        
int intWidth = 0;
        
for (int i = 0; i < intLength; i++)
        
{
            
string strNumberImg = Page.Server.MapPath("img/" + strStyle + "/" + strCount.Substring(i, 1+ ".jpg");
            Bitmap newBitmap 
= new Bitmap(strNumberImg);
            g.DrawImage(newBitmap, intWidth, 
0);
            
            
//每次描述的X坐標需要加上圖片的寬度
            intWidth += newBitmap.Width; 
        }


        System.IO.MemoryStream ms 
= new System.IO.MemoryStream();
        bmp.Save(ms, ImageFormat.Gif);

        
//輸出圖片
        Response.ClearContent();
        Response.ContentType 
= "image/gif";
        Response.BinaryWrite(ms.ToArray());
    }

}

示例代碼:/Files/heekui/RandCode_2.rar
(合在了一個(gè)以前的生成驗證碼圖片的項目里)

 

Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1520892

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
ASP.NET驗證碼
ASP.NET2.0文件上傳以及圖片處理總結篇
ASP.NET根據URL生成網(wǎng)頁(yè)縮略圖示例程序(C#語(yǔ)言)
ASP.net]Loading繪制
原創(chuàng ),c#簡(jiǎn)單驗證碼識別,發(fā)布一個(gè)趕集網(wǎng)的圖片電話(huà)號碼識別的代碼 驗證碼識別 瘋狂代碼
Android異步下載網(wǎng)絡(luò )圖片(其二)
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久