摘要:假设你设计一个和人交流的程序。 先建立一个接口 interface 人 //定义接口,它代表一个人, {void Hello(); }//接口虚函数,用来跟这个人说话但不同的人有不用的交流方式,具体方式用类来实现,比如。 class 美国人:人 //继承接口“人” 然后,类里实例化接口函数 void Hello(){说hi;}class 中国人:人 //继承接口“人” 然后,类里实例化接口函数 void Hello(){说你好;}class SB:人 //sb也是人 实现 Hello{说xxxxx;}最后你的程序运行时,就用接口“人”就可以了,因为不管遇到什么人(美国人,中国人,还是sb),都
阅读全文
随笔分类 - C# WinForm
摘要:1 DialogResult dr = ofdAddUserPicture.ShowDialog(); 2 this.picPicture.Image = Image.FromFile(ofdAddUserPicture.FileName); //显示图片 3 if (dr == DialogResult.OK) 4 { 5 user.Picture = ofdAddUserPicture.FileName; 6 } 7 ...
阅读全文
摘要:1.如何创建一个可改变大小没有标题栏的窗体?(How to create a form with resizing borders and no title bar?)form1.Text = string. Empty; form1.ControlBox = false;2. 如何在.NET的Windows窗体上启用XP主题集?(How to use XP Themes with Windows Forms using the .NET?)确认你的控件中FlatStyle属性已经修改为System,再修改Main方法。static void Main() { Application.Enab
阅读全文
摘要:[WebMethod]public string ShowWebServicePhysicalPath(){ string strpath=System.Web.HttpContext.Current.Request.PhysicalPath;return strpath.Substring(0,strpath.LastIndexOf(@"\")); }
阅读全文

浙公网安备 33010602011771号