chenhailong 发表于 2013-2-1 11:55:15

C# 语言的一些遗忘点

C# 语言的以一些遗忘点
C#调试和错误处理
打出错误信息
Debug.Write()
Trace.Write()
Debug.WriteLineIf()
Trace.WriteLine()
Debug.WriteIf()
Trace.WriteIf()
Debug.Assert()
Trace.Assert()
在派生类中重载虚方法时,要加上override修饰符
两个窗口form1和form2
点击form1中的一个按钮,打开form2同时关闭form1
form2 f2 = new form2();
f2.show();
this.close();  //也可以直接 close();
(注意:如果form1是主窗口。不可以close只能hide ,即this.hide())
若要退出当前程序:Application.exit();
 
 实现Form标题居中问题
      public Form()      {            InitializeComponent();            int i = this.Width/8;            string str = "";            i = i/2;            for (int z = 0; z < i; z++)            {                str = str + " ";            }            this.Text = str + this.Text;      } 
页: [1]
查看完整版本: C# 语言的一些遗忘点