乙個驗證碼程式,今天在網上無意中看到的,先收藏了:
validcode
using system;
using system.drawing;
using system.io;
using system.text;
using system.drawing.imaging;
using system.security.cryptography;
using system.drawing.drawing2d;
public partial class validcode : system.web.ui.page
/**////
/// 產生驗證碼
///
/// 驗證碼
public
static
string createauthstr(int len)
else
}return checkcode.tostring();}}
/**////
/// 驗證碼類
///
public
class verifyimage
}/**////
///
///
public bitmap image
}/**////
/// 寬度
///
public
int width
}/**////
/// 高度
///
public
int height
}private
string text;
private
int width;
private
int height;
private bitmap image;
private
static
byte randb = new
byte[4];
private
static rngcryptoserviceprovider rand = new rngcryptoserviceprovider();
/**////
/// 建構函式
///
/// 要顯示的驗證碼
/// 寬度
/// 高度
public verifyimage(string code, int width, int height)
~verifyimage()
public
void dispose()
protected
virtual
void dispose(bool disposing)
private fontfamily fonts = ;
public
static
int next()
public
static
int next(int max)
public
static
int next(int min, int max)
/**////
/// 生成驗證碼
///
private
void generateimage()
solidbrush drawbrush = new solidbrush(color.fromargb(next(100), next(100), next(100)));
for (int x = 0; x < 3; x++)
for (int x = 0; x < this.text.length; x++)
double distort = next(5, 10) * (next(10) == 1 ? 1 : -1);
using (bitmap copy = (bitmap)bitmap.clone())}}
//g.drawrectangle(new pen(color.silver), 0, 0, bitmap.width - 1, bitmap.height - 1);
font.dispose();
drawbrush.dispose();
g.dispose();
this.image = bitmap;}}
又乙個迷宮
有乙個迷宮,迷宮裡有乙個人,迷宮是規格為 n n 的方格,房內特定位置上有障礙物,人處於某一位置,可以選擇向上下左右方向前進,但是要保證面對的不是牆壁或是障礙物,否則無法向前行走。輸入迷宮的規格,乙個正整數 n 2 n 100 佔一行,代表矩陣大小 輸入方形矩陣 n 行 n 列,由 0 和 1 組成...
又乙個通宵
敲了一晚上的 閒下來摸魚寫了下字是孟浩然的 宿業師山房期丁大不至 宿業師山房待丁大不至 夕陽度西嶺,群壑倏已暝。松月生夜涼,風泉滿清聽。樵人歸欲盡,煙鳥棲初定。之子期宿來,孤琴候蘿徑。描寫詩人在山中等候遲遲未到的友人的場景 可以看看古詩詞網的賞析 傳送門 想起來這首詩也是我與師弟最後一起寫的呢 雖說...
又乙個Perl的程式(原創)
usr bin perl w use tk use tk pathentry use tk message use dirhandle use cwd my srcpath cwd my dstpath cwd mw mainwindow new title auto red eye removal...