01 2010 档案
摘要:c#要求所有的运算符重载都声明为public 和static,这表示他们与他们的类或结构相关联,而不与实例相关联。操作符的重载使用operator关键字,C#不允许重载=操作符。下面是一个重载+操作符的列子,代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--staticvoidMain(string[]args){Squarea=newSquare(3,3);Squareb=newSquare(5,5);Squarec=newSquare();c
阅读全文
摘要:线程间操作大家可以把Control.CheckForIllegalCrossThreadCalls设置为false,但这种操作只能用于简单的线程控制。不够安全。大部分情况下还是用Control.Invoke方法。具体用法如下: Control.Invoke(new EventHandler( delegate { //要编写的代码 }));
阅读全文
摘要://设置鼠标图标 Bitmap a = (Bitmap)Bitmap.FromFile("1.png"); SetCursor(a, new Point(16, 36)); //new Point() 定义鼠标的可用点位置。 //设置鼠标函数 public void SetCursor(Bitmap cursor, Point hotPoint) { int hotX = hotPoint.X; ...
阅读全文