推荐文章

c#去除字符串中的空格,回车,换行符,制表符

c#去除字符串中的空格,回车,换行符,制表符

c#去除字符串中的空格,回车,换行符,制表符
C#监控程序启动和关闭

C#监控程序启动和关闭

C#监控程序启动和关闭using System;using System.Collections.Generic;using System.Text;using System.Diagnostics;using System.Threading;namespace ProcessListener{ class Program { static void Main(stri
C#操作USB口的摄像头

C#操作USB口的摄像头

private const uint BM_CLICK = 0xF5; 鼠标点击的消息,对于各种消息的数值,查API手册,也可用VS2010自带的SPY++ [DllImpt("user32.dll", EntryPoint = "SendMessage", SetLastErr = true, Set = Set.Auto)]private static extern int SendMe
C# FTP操作

C# FTP操作

C# FTP操作
C#文件监控对象FileSystemWatcher

C#文件监控对象FileSystemWatcher

使用C#文件监控对象FileSystemWatcher对文件夹下的删除、修改、新增

C# 绘制验证码

日期:2018-07-05 点击:1290 来源:PB2.CN

/// <summary>
       
/// 绘制验证码
       
/// </summary>
       
/// <returns></returns>
       
public ActionResult VerificationCode()
        {
           
int _verificationLength = 6;
           
int _width = 100, _height = 20;
            SizeF _verificationTextSize;
            Bitmap _bitmap =
new Bitmap(Server.MapPath("~/Skins/Common/Texture.jpg"),true);
            TextureBrush _brush =
new TextureBrush(_bitmap);
           
//获取验证码
           
string _verificationText = Common.Text.VerificationText(_verificationLength);
           
//存储验证码
            Session[
"VerificationCode"] = _verificationText.ToUpper();
            Font _font =
new Font("Arial", 14, FontStyle.Bold);
            Bitmap _image =
new Bitmap(_width, _height);
            Graphics _g = Graphics.FromImage(_image);
           
//清空背景色
            _g.Clear(Color.White);
           
//绘制验证码
            _verificationTextSize = _g.MeasureString(_verificationText, _font);
            _g.DrawString(_verificationText,_font,_brush,(_width-_verificationTextSize.Width)/
2,(_height-_verificationTextSize.Height)/2);
            _image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
           
return null;
        }


这篇文档对您是否有帮助?

c#去除字符串中的空格,回车,换行符,制表符

c#去除字符串中的空格,回车,换行符,制表符

c#去除字符串中的空格,回车,换行符,制表符
C#监控程序启动和关闭

C#监控程序启动和关闭

C#监控程序启动和关闭using System;using System.Collections.Generic;using System.Text;using System.Diagnostics;using System.Threading;namespace ProcessListener{ class Program { static void Main(stri
C#操作USB口的摄像头

C#操作USB口的摄像头

private const uint BM_CLICK = 0xF5; 鼠标点击的消息,对于各种消息的数值,查API手册,也可用VS2010自带的SPY++ [DllImpt("user32.dll", EntryPoint = "SendMessage", SetLastErr = true, Set = Set.Auto)]private static extern int SendMe
C# FTP操作

C# FTP操作

C# FTP操作
C#文件监控对象FileSystemWatcher

C#文件监控对象FileSystemWatcher

使用C#文件监控对象FileSystemWatcher对文件夹下的删除、修改、新增