随笔分类 - C#学习
摘要:第三个读写配置类,使用的是注册表,由于以前没使用过注册表做为配置文件来读写,所以该类比较初级,只是按自己想法所写,有何不足请批评指教http://xingfustar.cnblogs.com/*----------------------------------------------------------------*版权:http://XingFuStar.cnblogs.com**文件名:...
阅读全文
摘要:刚写完读XML配置的类,突发奇想,想写一个不调用API来读INI文件的类,经过一点点努力,终于实现了,现将代码帖出。 http://xingfustar.cnblogs.com /*---------------------------------------------------------------- * 版权:http://XingFuStar.cnblogs.com * ...
阅读全文
摘要:以前读写配置都用INI文件,现在写一个读写XML的类,功能比较简单 http://xingfustar.cnblogs.com 我的问题是如何能得到根节点的名字,而不是像现在这样写死为“Configuration"。希望大家多多讨论,提出宝贵意见 /*---------------------------------------------------------------- * 版权:...
阅读全文
摘要:Select CASE 列名 When 1 Then '是' Else '否' End AS 列重命名From 表名
阅读全文
摘要:最近领导要求把一些数导入Excel生成报表, 工作本来是要手动完成的,但咱是做程序的, 应该想一切办法让程序来代替我们完成任务, 于是写了一个操作Excel的程序, 现将代码公布, 希望对读本文的朋友有所帮助 http://xingfustar.cnblogs.com 代码写的不好,请多原谅, 目的与大家多交流学习,有什么问题,欢迎指出. http://xingfustar.cnblogs....
阅读全文
摘要:去年写过一个C#系统热键类,那个类是从别人的代码修改过来的,今天在使用时发现,还有很多不完善的地方,于是修改了一下,加了些注释 using System;using System.Runtime.InteropServices;namespace HotKeys{ public delegate void HotkeyEventHandler(int HotKeyID); public...
阅读全文
摘要:添加引用"System.Design.Dll"添加命名空间"using System.Windows.Forms.Design; " public class FolderDialog : FolderNameEditor{ FolderNameEditor.FolderBrowser fDialog = new System.Windows.Forms.Design.FolderNa...
阅读全文
摘要:更新桌面使用接口:IActiveDesktopCom接口不能直接在.net中使用,所以需要在.net中重新定义,接口中使用的 , 结构也需要重新定义从网上找到这样一个类引用地址:http://www.dotnet247.com/247reference/msgs/41/205722.aspx using System;using System.Runtime.InteropServices;nam...
阅读全文
摘要:this.Location = new System.Drawing.Point(Screen.PrimaryScreen.Bounds.Width - this.Width, Screen.PrimaryScreen.Bounds.Height - 100);for (int i = 0; i < Screen.PrimaryScreen.Bounds.Height; i++){ this...
阅读全文
摘要:/// /// 返回字符串的首写字母字符串/// /// 需得到首写字母的字符串/// public String UtilIndexCode(String IndexTxt){ string _Temp=null; for(int i=0;i=0 && Convert.ToChar(OneIndexTxt)<256) return OneIndexTxt; els...
阅读全文
摘要:public int Length(string strLen){ int l,t,c; int i; l=strLen.Length ; t=l; for( i=0;i255) { t=t+1; } } return t;}public string Substring(string strValue, ...
阅读全文
摘要:using System;using System.Runtime.InteropServices;using System.Text;namespace Sunmast.Hardware{ [Serializable] public struct HardDiskInfo { /// /// 型号 /// public...
阅读全文
摘要:在窗体中加入如下代码 private static 窗体 instance = null;//添加一个属性public static 窗体 Instance{ set{ } get{ if(instance == null){ new 窗体(); } return instance; }} 在窗...
阅读全文
摘要:WinForm: public string GetMD5(string str){ byte[] b = System.Text.Encoding.Default.GetBytes(str); b = new System.Security.Cryptography.MD5CryptoServiceProvider().ComputeHash(b); StringBuilder...
阅读全文
摘要:添加引用 using System;using System.Text;using System.Security.Cryptography;using System.IO; //默认密钥向量private static byte[] Keys = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };/// /// DES加密字符串/// ///...
阅读全文
摘要:新建一个工程,在工具箱上单击右键,选择"添加/移除项",在com组件列表中选择Shockwave Flash Object,然后确定,加载Flash控件到工具箱选择工具箱上的Flash控件,放到窗体上并调整好大小在Form_Load()中加入如下代码 axShockwaveFlash1.Movie =@"D:\menu.swf"; //这里一定要写绝对地址axShockwaveFlash1.Men...
阅读全文
摘要:添加引用 using System.Reflection;using System.Runtime.InteropServices;using System.Diagnostics; 调用DLL文件 [DllImport("User32.dll")]private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);[DllIm...
阅读全文
摘要:在Form_Load中输入如下代码: foreach(Control ctrl in this.Controls) { if ((ctrl is TextBox) || (ctrl is ComboBox)) //如果文本框或下拉框放在组合框中,你应该用如groupBox1.TextBox { ctrl.KeyDown += new System.Windows.F...
阅读全文
摘要:在窗体的类中声明两个变量 private Point mouseOffset; //记录鼠标指针的坐标private bool isMouseDown = false; //记录鼠标按键是否按下 创建该窗体 MouseDown事件的相应处理程序,注示部分为坐标的补偿 private void Form1_MouseDown(object sender, System.Windows.Forms.M...
阅读全文
摘要:C#系统热键类 using System;using System.Runtime.InteropServices;namespace SystemHotKey{ public delegate void HotkeyEventHandler(int HotKeyID); public class Hotkey : System.Windows.Forms.IMessageFilter...
阅读全文

浙公网安备 33010602011771号