2011年7月30日
摘要: View Code staticvoidMain(string[]args){ConsoleKeyInfoc=newConsoleKeyInfo();ConsoleKeyInfocki;do{cki=Console.ReadKey();if((cki.Modifiers&ConsoleModifiers.Control)!=0)Console.WriteLine("ctrl");if((cki.Modifiers&ConsoleModifiers.Alt)!=0)Console.WriteLine("alt");if((cki.Modif 阅读全文
posted @ 2011-07-30 23:53 wtq 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 1,以下代码显示被除0的错误提示代码如下:View Code staticvoidMain(string[]args){intaa=Console.In.Read();Console.Out.Write(aa);Console.ReadLine();inta=10;intb=0;try{intc=a/b;}catch(DivideByZeroExceptionexe){Console.WriteLine(exe.Message+""+"不能被整除");Console.WriteLine(exe.HelpLink);Console.WriteLine(ex 阅读全文
posted @ 2011-07-30 22:52 wtq 阅读(362) 评论(0) 推荐(0) 编辑
摘要: View Code staticvoidMain(string[]args){List<Person>personL=newList<Person>();personL.Add(newPerson("wtq","男","13616009873",23));personL.Add(newPerson("wta","女","13616009871",24));personL.Add(newPerson("wtb","男&quo 阅读全文
posted @ 2011-07-30 16:54 wtq 阅读(7845) 评论(0) 推荐(0) 编辑
摘要: View Code staticvoidMain(string[]args){List<Person>personL=newList<Person>();personL.Add(newPerson("wtq","男","13616009873",23));personL.Add(newPerson("wta","女","13616009871",24));personL.Add(newPerson("wtb","男&quo 阅读全文
posted @ 2011-07-30 16:15 wtq 阅读(867) 评论(0) 推荐(1) 编辑
摘要: 绘制多行文本,如图:思路主要设置drawstring的第二个参数的高度,这样就ok了。代码如下;View Code //privatevoidForm1_Paint(objectsender,PaintEventArgse)//{//Graphicsg=e.Graphics;//FontFamilyff=newFontFamily(GenericFontFamilies.Serif);//Fontf=newFont(ff,12,FontStyle.Italic|FontStyle.Bold|FontStyle.Strikeout|FontStyle.Underline);//stringst. 阅读全文
posted @ 2011-07-30 01:21 wtq 阅读(805) 评论(0) 推荐(0) 编辑
摘要: 绘制有边框的字体,如图思路,通过stringMessure来获取字体的长度。如下:View Code privatevoidForm1_Paint(objectsender,PaintEventArgse){Graphicsg=e.Graphics;FontFamilyff=newFontFamily(GenericFontFamilies.Serif);Fontf=newFont(ff,12,FontStyle.Italic);stringstr="Height"+f.Height;//不添加而外的高度SizeFsf=g.MeasureString(str,f,int.M 阅读全文
posted @ 2011-07-30 00:59 wtq 阅读(1364) 评论(0) 推荐(0) 编辑