随笔分类 - .NET源码
把ORACLE数据库中的bblob字段导成图片(C#实现)
摘要:string myOraclestr = "Data Source=" + this.textBox1.Text + ";User Id=" + this.textBox2.Text + ";Password=" + this.textBox3.Text + ";";OracleConnection conn = new OracleConnection(myOraclestr);OracleCo...
阅读全文
在C#中生成指定长度的随机字符
摘要:/// ///得到随机字符. /// ///Length of the int. ///if set to true [boo number]. ///if set to true [boo sign]. ///if set to true [boo smallword]. ///if set to true [boo bigword]. /// public string getRandomiz...
阅读全文
C#中对字符串加密解密(对称算法)
摘要:/// /// 字符串加密组件 /// public class Encrypt { #region "定义加密字串变量" private SymmetricAlgorithm mCSP; //声明对称算法变量 private const string CIV = "Mi9l/+7Zujhy12se6Yjy111A"; //初始化向量 private con...
阅读全文
C#中文件与文件夹相关的操作
摘要:/// /// 文件有关的操作类 /// public class FileOperate { /// /// 删除文件 /// /// 文件的全路径. /// bool public bool DeleteFile(string FileFullPath) { if (File.Exists(FileFullPath...
阅读全文
C#程序中如何调用Windows API函数
摘要:[DllImport("kernel32.dll")] //在C#程序中使用Win32类库 public static extern bool Beep(int frequency, int duration); //使用extern来指明该函数的实际代码在别处 static void Main(string[] args) { Random random = new Rando...
阅读全文
使 TextBox1 的 UI 可以更新
摘要:Timer timer1; int curNum; System.Threading.Thread thread; /// /// 自动增加 (使 TextBox1 的 UI 可以更新) /// /// The source of the event. /// The instance containing the event data. private void button1_Cl...
阅读全文
C# Form中的Label标签的数字自动递增1,并能正常显示递增(不是一步到位)
摘要:Label标签显示从1到10000(递增1) for (int i = 0; i <= 10000; i++) { label1.Text = i.ToString(); this.Refresh(); Application.DoEvents(); //延时20毫秒,一般和上一条语句一起使用 } GC.Collect();
阅读全文
C#如何判断一个字符串中中文和字母或数字的个数(转载)
摘要:int inum=0; int ichar = 0; int ichi = 0; string strTemp; for (int i = 0; i -1) { inum++; } else if ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTU...
阅读全文