Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ASP.NETÖÐʹÓÃÑéÖ¤Âë¼¼Êõ

 ÓÉÓÚÑéÖ¤Âë¼¼ÊõÖзþÎñÆ÷³ÌÐòÐèÒª´´½¨ÑéÖ¤ÂëͼƬ£¬ÀïÃæÓõ½ÁËͼÐαà³Ì£¬Òò´Ë±¾½Ú¿Î³ÌÈÔÈ»ÊÇC#·¢ÏÖÖ®ÂõÄͼÐαà³ÌϵÁн̡̳£
     ¸ù¾ÝÑéÖ¤ÂëµÄÔ­Àí£¬ÎÒÃÇʹÓÃC#ÔÚASP.NETÖÐʵÏÖÁËÑéÖ¤ÂëµÄ¹¦ÄÜ¡£
checkimage.aspx
     Ê×Ïȸù¾ÝÉϽڿγ̵ÄÄÚÈÝ£¬ÎÒÃÇÒª´´½¨Ò»¸öͼƬ·þÎñÒ³Ã棬רÃÅÓÃÓÚÌṩ°üº¬ÑéÖ¤ÂëÎı¾µÄͼƬ£¬Îª´ËÎÒÃǽ¨Á¢Ò»¸ö checkimage.aspx µÄÒ³Ãæ¡£ÆäHTML´úÂëºÜ¼òµ¥£¬Ö»ÓÐÒ»ÐУ¬²»Êä³öÈκÎÄÚÈÝ¡£ÔÚÆäPage_Load·½·¨ÖоÍÓд´½¨ÑéÖ¤ÂëͼƬµÄ¹ý³Ì¡£
// ´´½¨Ò»¸ö°üº¬Ëæ»úÄÚÈݵÄÑéÖ¤ÂëÎı¾
System.Random rand = new Random();
int len = rand.Next(4 , 6 );
char[] chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
System.Text.StringBuilder myStr = new System.Text.StringBuilder();
for( int iCount = 0 ; iCount < len ; iCount ++ )
{
    myStr.Append( chars[ rand.Next( chars.Length )]);
}
string text = myStr.ToString();
// ±£´æÑéÖ¤Âëµ½ session ÖÐÒÔ±ãÆäËûÄ£¿éʹÓÃ
this.Session["checkcode"] = text ;
Size ImageSize = Size.Empty ;
Font myFont = new Font("MS Sans Serif" , 20 );
// ¼ÆËãÑéÖ¤ÂëͼƬ´óС
using( Bitmap bmp = new Bitmap( 10 , 10 ))
{
    using( Graphics g = Graphics.fromImage( bmp ))
    {
        SizeF size = g.MeasureString( text , myFont , 10000 );
        ImageSize.Width = ( int ) size.Width + 8 ;
        ImageSize.Height = ( int ) size.Height + 8 ;
    }
}
// ´´½¨ÑéÖ¤ÂëͼƬ
using( Bitmap bmp = new Bitmap( ImageSize.Width , ImageSize.Height ))
{
    // »æÖÆÑéÖ¤ÂëÎı¾
    using( Graphics g = Graphics.fromImage( bmp ))
    {
        g.Clear( Color.White );
        using( StringFormat f = new StringFormat())
        {
         &


Ïà¹ØÎĵµ£º

ASP.NETÒ³Ãæˢз½·¨×ܽá

 µÚÒ»£º
private void Button1_Click( object sender, System.EventArgs e ) { Response.Redirect( Request.Url.ToString( ) ); } µÚ¶þ£º
private void Button2_Click( object sender, System.EventArgs e ) { Response.Write( " < script language=javascript>window.location.href=document.URL; < /sc ......

ASP.NET

Ê®¡¢ÈçºÎ£º¶ÁÈ¡ Calendar Web ·þÎñÆ÷¿Ø¼þÖеÄÑ¡¶¨ÈÕÆÚ
      µÚÒ»¸öʾÀýÏÔʾµ±Ç°Ñ¡¶¨µÄÈÕ¡£µÚ¶þ¸öʾÀýÏÔʾËùÓÐÑ¡¶¨µÄÈÕÆÚ£¬¿ÉÒÔÊǵ¥¸öÈÕ¡¢ÖÜ»òÔ¡£
// Example 1
Label1.Text = Calendar1.SelectedDate.ToShortDateString();
 
// Example 2
String s = "";
foreach(DateTime d in Ca ......

ASP.NET

      CheckBox ¿Ø¼þºÍ CheckBoxList ¿Ø¼þΪÓû§ÌṩÁËÒ»ÖÖÖ¸¶¨ÊÇ/·ñ£¨Õæ/¼Ù£©Ñ¡ÔñµÄ·½·¨¡£
 
Ò»¡¢¹¦ÄÜ
¿ÉÒÔʹÓà CheckBox ¿Ø¼þºÍ CheckBoxList ¿Ø¼þÖ´ÐÐÒÔϲÙ×÷£º
·µ±Ñ¡ÖÐij¸ö¸´Ñ¡¿òʱ½«ÒýÆðÒ³»Ø·¢¡£
·µ±Óû§Ñ¡ÖÐij¸ö¸´Ñ¡¿òʱ²¶»ñÓû§½»»¥¡£
·½«Ã¿¸ö¸´Ñ¡¿ò°ó¶ ......

ASP.NET

Áù¡¢ÈçºÎ£ºÒÔ±à³Ì·½Ê½»ñÈ¡ºÍÉèÖà CheckBox Web ·þÎñÆ÷¿Ø¼þÖµ
      ¿ÉÒÔÓñà³Ì·½Ê½¶ÁÈ¡»òÉèÖà CheckBox Web ·þÎñÆ÷¿Ø¼þµÄÖµ¡£
˵Ã÷£º Èç¹ûÄúʹÓõÄÊÇ CheckBoxList ¿Ø¼þ£¬Ôò»ñÈ¡ºÍÉèÖø´Ñ¡¿òÖµµÄ¹ý³Ì»áÓÐËù²»Í¬¡£
      »ñÈ¡»òÉèÖà CheckBox ¿Ø¼þµÄ Checked ÊôÐÔ¡£Èç ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ