摘要:(一).功能 1. JavaScript检索CheckBox并实现全选和全消功能 用C#等写的CheckBox需要回发到服务端执行, 而用JavaScript可以在直接客户端实现,效率高些 (二).代码 1. DataGrid中的代码主要片段: //头模板代码 ...
阅读全文
文章分类 - C#专栏
C#相关知识
摘要:using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data; using DxVBLib; namespace 播放音乐{ /// /// Form1 的摘要说明。 /// public cl...
阅读全文
摘要:using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.Diagnostics; namespace WindowsApplication3{ /// /// Fo...
阅读全文
摘要:(一).说明 功能:用鼠标实现拖动图片. 用法:将鼠标指向一图片,按住鼠标左键拖动. 图片会随鼠标一起移动. (二).代码 (说明: 此功能我用的用途是将象棋游戏之棋子拖动效果) 读者可以将此功能用作其它用途,也可以用作设计其它的游戏. using System;using System.Drawing;using System.Collections;using S...
阅读全文
摘要:(一).功能 一个演示图像格式转换的示例程序. 支持格式: bmp jpeg gif tiff png wmf 等之间的相互转换 (二).代码(整个后台代码) using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows....
阅读全文
摘要:using System; namespace Array操作{ /// /// Class1 的摘要说明。 /// class Class1 { /// /// 应用程序的主入口点。 /// [STAThread] static void Main(string[] args) { // // TODO: 在此处添加代码以启动应用程序 // String[] ...
阅读全文
摘要:using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data; namespace 模拟鼠标{ /// /// Form1 的摘要说明。 /// public class Form1 : Sys...
阅读全文
摘要:using System;using System.Collections;using System.Collections.Specialized; namespace 集合和同步{ /// /// Class1 的摘要说明。 /// class Class1 { public static void DemoLockCollection() { StringDictionary s...
阅读全文
摘要:using System;using System.Collections;using System.Collections.Specialized; namespace 集合的拷贝{ /// /// Class1 的摘要说明。 /// class Class1 { [STAThread] static void Main(string[] args) { NameValueCo...
阅读全文
摘要:using System;using System.Collections; namespace 集合的比较和排序{ public class Efficience:IComparable { private int workHour; private int outPut; int IComparable.CompareTo(Object obj) { if(obj==null) ...
阅读全文
摘要:(一).功能 有时候由于显示效果,需要将某个控件变一下形状. 本文举例将PictureBox[]数组变成圆形. (二).代码 (这里说明一下,我个人将它变形是因为我用PictureBox表示象棋棋子, 由于PictureBox默认是方 的, 所以得把它变成圆的) 大家可以将这个功能作为其它用途使用. using System;using System...
阅读全文
摘要:(一).说明 将鼠标指向一幅图片的一块区域,此区域会放大显示,变清晰.用类: Graphics 实现. (二).代码 using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using...
阅读全文
摘要:(一).说明 初学ADO.Net会被ADO.Net访问数据库方式弄得头晕,感觉无从下手.本文将它们整合在一起,文章并没有涉及太多深层知识. 只是我觉得将它们集中在一起,在比较中学习更快,更清晰一些: 本文列举了用ADO.Net访问数据库的所有方式:1.用Sql语句访问数据库2.用无参存储过程访问数据库3.用有参存储过程访问数据库4.使用 CommandBuilder.DerivePa...
阅读全文
摘要:using System;using System.IO;namespace 查看文件和子目录项目{ /// /// Class1 的摘要说明。 /// class ExploreFile { static int dirCounter=1; static int indentLevel=-1; static int fileCounter=0; /// /// 应用程序的主入口点...
阅读全文
摘要:(一). 说明 一个播放音乐的类,直接COPY就可以用了. 可用于自己编写的游戏等一些需要播放音乐的地方. 只要给它正在的文件名 就OK了. 具体看下面代码. (二).步骤 using System;//using System.Drawing;using System.Collections;using System.ComponentModel...
阅读全文
摘要://生成随机数函数中从strchar 数组中随机抽取//字母区分大小写//参数n为生成随机数的位数,一般取四位public string RandomNum(int n) //{ string strchar = "0,1,2,3,4,5,6,7,8,9" ; string[] VcArray = strchar.Split(',') ; string VNum = "" ;//由于字符串很短,...
阅读全文
摘要:(一). 说明 1.继承IComparer接口,可以自定义比较器2.由于Array.Sort()方法接受IComparer参数,进行自定义排序规则. 示例中也将IComparer作为Sort方法的参数,将Icomparer应用于Array.Sort()方法 (二).示例代码 using System;using System.Collections; namespace 比较器ICompare...
阅读全文
摘要:(一) 序幕 当DataSet中同时包含主/子表(主键表/外键表)时,有时候关系约束太严格: 比如, 关系数据库完整性规则: 1.实体完整性. 主键表中主键不准为空. 2.参照完整性. 外键表中外键的值必须与主键表中的主键对应. 要么为空,要么为主键表中的一主键值. 3.自定义完整性. 如果DataSet表中定义的多表关系约束...
阅读全文
摘要:(一).说明 在编程过程中有没有遇到这样的问题: 偶尔因为某种原因,数据库表需要改一字段名称。比如:将: Name改为: PersonName. 接下来程序员就把所有涉及到的代码打开,找到类似: ds.Table[0].Row[n]["Name"]的语句,修改成: ds.Table[0].Row[n]["Name"]. 其实完全可以不用这么做,只加一个带结构的DataSet就OK了。 ...
阅读全文
摘要:/// /// /// 存储类(存储UserInfo信息)/// /// /// 用Cache存储用户信息/// 在指定间隔(TimeOut)内取,则可以从Cache中取,/// 如果超出存储时间,则从数据库取用户信息数据/// 作為所有用户信息的存儲類./// /// /// ChengKing /// /// using System;using Sys...
阅读全文
浙公网安备 33010602011771号