随笔分类 -  C#学习

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