摘要: 首先在控制台项目中添加应用程序配置文件App.config(注意这个配置文件名不能修改)在该配置文件中代码如下:<?xml version="1.0" encoding="utf-8" ?><configuration> <appSettings> <add key="Website" value="http://www.mronginfo.com"/> </appSettings> <connectionStrings> <add na 阅读全文
posted @ 2013-03-26 15:32 Predator 阅读(331) 评论(0) 推荐(0) 编辑
摘要: Application.Exit();//注意Application在using System.Windows.Forms命名空间中;System.Diagnostics.Process.GetCurrentProcess().Kill(); 阅读全文
posted @ 2013-03-26 15:18 Predator 阅读(717) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using CustomLib;namespace ConTest{ //委托的声明delegate void f(); delegate void f1(int n, int m); delegate void f2(string s1, string s2, string s3); class Sample { //为委托赋值注意下面奇怪的地方f f_fun = delegate { Console.WriteLine(&quo 阅读全文
posted @ 2013-03-26 14:24 Predator 阅读(123) 评论(0) 推荐(0) 编辑
摘要: class Sample { //event EventHandler clickSample= delegate { };//这种方式也行 event EventHandler clickSample = delegate(object sender,EventArgs e) { }; public static void Main(string[] args) { Sample sam1 = new Sample(); sam1.btnStartup_Click(new object(), new EventArgs()); Console.Read(); } public void bt 阅读全文
posted @ 2013-03-26 14:03 Predator 阅读(208) 评论(0) 推荐(0) 编辑
摘要: public enum Color { Red=1, Green=2, Blue=3 } Color red = Color.Red; Console.WriteLine(red);//Red; Console.WriteLine(Color.Green);//Green Console.WriteLine(red.GetType());//CustomLib.Color Console.WriteLine((int)red);//1 //Console.WriteLine(Color);//error Color is type //Console.WriteLine(Player);//e 阅读全文
posted @ 2013-03-26 11:56 Predator 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 比如在类库CustomLib的DataService.cs文件中添加using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace CustomLib{ public enum BoolTF:int { False=0, True=1 } public enum Color { Red=1, Green=2, Blue=3 } public struct Student { public string Name; public int Age; } public clas.. 阅读全文
posted @ 2013-03-26 11:23 Predator 阅读(360) 评论(1) 推荐(0) 编辑
摘要: private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { MessageBox.Show(this.dateTimePicker1.Value.ToString());//返回日期和时间2013/32/6 10:06 MessageBox.Show(this.dateTimePicker1.Value.ToShortDateString());//返回日期2013/3/26 MessageBox.Show(this.dateTimePicker1.Value.ToOADate().ToString());// 阅读全文
posted @ 2013-03-26 10:08 Predator 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 先添加ToopTip控件到Form窗体上,命名:btnStartUpToolTip然后添加Button的MouseMove事件处理函数,如下:private void btnStartUp_MouseMove(object sender, MouseEventArgs e) { if ( sender is Button ) { Button btn=sender as Button; this.btnStartUpToolTip.SetToolTip(btn, "启动"); } } 阅读全文
posted @ 2013-03-26 09:37 Predator 阅读(440) 评论(0) 推荐(0) 编辑