2013年5月17日
摘要: 委托很好用,c#的委托有点函数指针的感觉,它能简化判断语句的使用,还能为窗口添加新的事件。weituo.csusing System; using System.Collections.Generic; using System.Linq; using System.Text; namespace fenzhi { public delegate int AddDelegate(int x, int y); public class weituo { static public int Add(int x, int y) { ... 阅读全文
posted @ 2013-05-17 20:29 月神苍龙 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 快速排序的基础原理就是分治算法,通过越来越小的划分块,来实现减小时间复杂度的问题。public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { int[] a = { 21, 23, 4, 2, 12, 34, 54, 32, 17 }; ... 阅读全文
posted @ 2013-05-17 20:04 月神苍龙 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 对于打印页面来说,网页打印有很大的优势,因为有函数直接打印window.Print()就可以了很方便,但是对于winform除了使用一些第三方的类库之外就需要自己写代码了。PrintDocument printDocument1 = new PrintDocument();PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog();PrintDocument printDialog1 = new PrintDocument();private void button1_Click(object sender, EventA 阅读全文
posted @ 2013-05-17 19:56 月神苍龙 阅读(836) 评论(0) 推荐(0) 编辑
摘要: 串口通讯最痛苦的在于无法深入了解串口内部的规则,只能调用c#提供的SerialPort类,但是使用的时候也出现了很多问题,有的是自身的有的是由于不了解造成的。首先SerialPort类提供了很多很好的方法,对于读写都很有帮助,但是有的读是同步,有的是异步,同步就是和主程序保持一致,只有运行完了ReadByte之后才能运行程序之后的代码,异步就是重新开启一个线程来处理这些问题,主程序不受到干扰,继续运行。serialPort中有6个读的方法:Read();ReadLine()ReadByte();ReadChar();ReadExisting();ReadTo();ReadTo和ReadExis 阅读全文
posted @ 2013-05-17 19:44 月神苍龙 阅读(2252) 评论(0) 推荐(0) 编辑