包含vb.netsha1的词条( 六 )


base.Response.Cookies.Add(new HttpCookie("CheckCode", SHA1(strListNum)));
this.CreateImage(strListNum);
}
private void CreateImage(string checkCode)
{
int iwidth = checkCode.Length * 8;
Bitmap image = new Bitmap(70, 30);
Graphics g = Graphics.FromImage(image);
g.SmoothingMode = SmoothingMode.HighQuality;
Font f = new Font("Arial ", 14f, FontStyle.Bold);
Brush b = new SolidBrush(Color.Black);
Rectangle rect = new Rectangle(0, 0, 80, 30);
HatchBrush hatchBrush = new HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.LightGray, Color.LightSkyBlue);
g.FillRectangle(hatchBrush, rect);
float CPostion = 1f;
for (int i = 0; icheckCode.Length; i++)
{
this.TransformG(g);
SizeF size = g.MeasureString(checkCode[i].ToString(), f);
g.DrawString(checkCode[i].ToString(), f, b, CPostion, 5f);
CPostion += size.Width - 1f;
g.ResetTransform();
}
MemoryStream ms = new MemoryStream();
image.Save(ms, ImageFormat.Jpeg);
g.Dispose();
image.Dispose();
base.Response.ClearContent();
base.Response.ContentType = "image/Jpeg";
base.Response.BinaryWrite(ms.ToArray());
}
private void TransformG(Graphics g)
{
Matrix myMatrix = new Matrix();
int num1 = this.rand.Next(80, 900);
int num2 = this.rand.Next(80, 800);
float dd1 = num1;
float dd2 = num2;
dd1 /= 10000f;
dd2 /= 10000f;
float f1 = dd1;
float f2 = dd2;
myMatrix.Shear(f1, f2);
g.MultiplyTransform(myMatrix);
}
}
}
vb.netsha1的介绍就聊到这里吧 , 感谢你花时间阅读本站内容,更多关于、vb.netsha1的信息别忘了在本站进行查找喔 。

推荐阅读