嘿嘿 既然大家不笑 那么再问一个 解释最简单的程序 namespace Microsoft.Samples.WinForms.Cs.SimpleHelloWorld { using System; using System.Windows.Forms; public class SimpleHelloWorld : Form { [STAThread] //??不明白 public static int Main(string[] args) { //??不明白 (string[] args) Application.Run(new SimpleHelloWorld()); return 0; //?? 0 什么意思 } public SimpleHelloWorld() { this.Text = "Hello World"; } } }
嘿嘿 既然大家不笑 再问一个 解释最简单的程序 namespace Microsoft.Samples.WinForms.Cs.SimpleHelloWorld { using System; using System.Windows.Forms; public class SimpleHelloWorld : Form { //来两句 [STAThread] //??什么意思 public static int Main(string[] args) { //括号后面解释 Application.Run(new SimpleHelloWorld()); return 0; // 0 哪里来的 } public SimpleHelloWorld() { this.Text = "Hello World"; } } }
button1.Click += new System.EventHandler(button1_Click);
“+=” 又是什么意思 这些好像找不到答案阿
string[] args是 该程序启动是被赋予的参数。就像 format c: /sbutton1.Click += new System.EventHandler(button1_Click);是设置事件托管。表示在button1.Click时,执行button1_Click。return 0;没什么意义!只是给个返回值,表示成功与否。
("aa={0} bb={1}",aa,bb){0}就代表aa
{1}就代表bb
e携带着事件源的信息
举个例子 好吗
那么再问一个 解释最简单的程序
namespace Microsoft.Samples.WinForms.Cs.SimpleHelloWorld {
using System;
using System.Windows.Forms; public class SimpleHelloWorld : Form { [STAThread] //??不明白
public static int Main(string[] args) { //??不明白 (string[] args)
Application.Run(new SimpleHelloWorld());
return 0; //?? 0 什么意思
} public SimpleHelloWorld() {
this.Text = "Hello World";
}
}
}
再问一个 解释最简单的程序
namespace Microsoft.Samples.WinForms.Cs.SimpleHelloWorld {
using System;
using System.Windows.Forms; public class SimpleHelloWorld : Form { //来两句 [STAThread] //??什么意思
public static int Main(string[] args) { //括号后面解释
Application.Run(new SimpleHelloWorld());
return 0; // 0 哪里来的
} public SimpleHelloWorld() {
this.Text = "Hello World";
}
}
}
“+=” 又是什么意思
这些好像找不到答案阿
准确的说[STAThread]的全文是[STAThreadAttribute]
你查一下MSDN属性编程就知道了
object sender指的是消息的发送者,
如Button_Click事件中的事件发送者即为Button,
但在使用时需对sender进行转换.
Eventargs e则是Eventargs类的一个实例,主要表示事件中的一些信息。