摘要: 冒泡排序usingSystem;namespaceBubbleSorter{publicclassBubbleSorter{publicvoidSort(int[]list){inti,j,temp;booldone=false;j=1;while((j<list.Length)&&(!done)){done=true;for(i=0;i<list.Length-j;i++){if(list[i]>list[i+1]){done=false;temp=list[i];list[i]=list[i+1];list[i+1]=temp;}}j++;}}}publicclassMai 阅读全文
posted @ 2012-01-30 16:59 晴天有时下鱼 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 为什么要用INI文件?如果我们程序没有任何配置文件时,这样的程序对外是全封闭的,一旦程序需要修改一些参数必须要修改程序代码本身并重新编译,这样很 不好,所以要用配置文件,让程序出厂后还能根据需要进行必要的配置;配置文件有很多如INI配置文件,XML配置文件,还有就是可以使用系统注册表等。 本文主要是为读者在实现读写INI配置文件模块之前,提供有关INI文件的格式信息。在 早期的windows桌面系统中主要是用INI文件作为系统的配置文件,从win95以后开始转向使用注册表,但是还有很多系统配置是使用INI文件的。 其实INI文件就是简单的text文件,只不过这种txt文件要遵循一定的INI文. 阅读全文
posted @ 2012-01-30 16:58 晴天有时下鱼 阅读(328) 评论(0) 推荐(0) 编辑
摘要: c#读取INI文件using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;namespace 读写ini文件{ public class Ini { // 声明INI文件的写操作函数 WritePrivateProfileString() [System.Runtime.InteropServices.DllImport("kernel32")] private static extern long WritePrivateProfil 阅读全文
posted @ 2012-01-30 16:57 晴天有时下鱼 阅读(222) 评论(0) 推荐(0) 编辑
摘要: net 提供了Thread类用于线程的操作。当初始化一个线程,把Thread.IsBackground=true的时候,指示该线程为后台线程。后台线程将会随着主线程的推出而退出。后台线程不妨碍程序的终止,只要所有前台线程都终止后,CLR就会对每一个活在的后台线程调用Abort()来彻底终止应用程序。【注意】当在主线程中创建了一个线程,那么该线程的IsBackground默认是设置为FALSE的。也就是说,当主线程推出的时 候,IsBackground=FALSE的线程还会继续执行下去,知道线程执行结束。只有IsBackground=TRUE的线程才会顺着主线程的推 出而退出。static vo 阅读全文
posted @ 2012-01-30 16:55 晴天有时下鱼 阅读(405) 评论(0) 推荐(0) 编辑
摘要: string strSql = "select AMID as [编号],AMLX as [类型] from SYS_AlarmType order by AMID"; DataTable DT = TH.TracerEnerView.DBUtility.DbHelperSQL.Query(strSql).Tables[0]; comboBoxType.DataSource = DT; comboBoxType.DisplayMember = "类型"; comboBoxType.ValueMember = "编号"; 阅读全文
posted @ 2012-01-30 16:54 晴天有时下鱼 阅读(956) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;namespace WindowsFormsApplication1{ public partial class Form1 : Form { [DllImport("User32.dll " 阅读全文
posted @ 2012-01-30 16:53 晴天有时下鱼 阅读(151) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 配置文件操作类 /// </summary> public class iniOperate { /// <summary> /// ini配置文件路径 /// </summary> public string inipath; [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filePath) 阅读全文
posted @ 2012-01-30 16:52 晴天有时下鱼 阅读(365) 评论(0) 推荐(0) 编辑
摘要: string是引用类型; string str = null 没有创建内存空间,str中存放的是空引用指针; string str = "" 创建了内存空间,str中存放的是指向堆中的指针。简单地说: string str =""; 给你一张白纸; string str = null; 连白纸也没有。string.Empty就相当于"" 一般用于字符串的初始化 比如: string a; Console.WriteLine(a);//这里会报错,因为没有初始化a 而下面不会报错: string a=string.Empty; Cons 阅读全文
posted @ 2012-01-30 16:48 晴天有时下鱼 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 在每一个窗体生成的时候,都会针对于当前的窗体定义InitializeComponent()方法,该方法实际上是由系统生成的对于窗体界面的定义方法。//位于.cs文件之中的InitializeComponent()方法publicForm011(){InitializeComponent();} 在每一个Form文件建立后,都会同时产生程序代码文件.CS文件,以及与之相匹配的.Designer.CS文件,业务逻辑以及事件方法等被编写在.CS文件之中,而界面设计规则被封装在.Designer.CS文件里,下面代码为.Designer.CS文件的系统自动生成的脚本代码。 namespace Exam 阅读全文
posted @ 2012-01-30 16:48 晴天有时下鱼 阅读(553) 评论(0) 推荐(0) 编辑
摘要: Application.EnableVisualStyles()的作用和Application.SetCompatibleTextRenderingDefault函数Application.EnableVisualStyles()的作用和Application.SetCompatibleTextRenderingDefault函数public static void EnableVisualStyles () 此方法为应用程序启用可视样式。如果控件和操作系统支持视觉样式,则控件将以视觉样式进行绘制。若要使 EnableVisualStyles 生效,必须在应用程序中创建任何控件之前调用它;E. 阅读全文
posted @ 2012-01-30 16:45 晴天有时下鱼 阅读(1039) 评论(0) 推荐(0) 编辑