public class Login : System.Windows.Forms.Form手写的! 自动生成的窗体代码,会using System.Windows.Forms 所以只需要用Form,简写的名字。
如果你类前有using System.Windows.Form; 那么 public class Login : System.Windows.Forms.Form和public class Login : Form 是一样的,如果类前没有using System.Windows.Form; 那么public class Login : Form 编译时会出错
加上using System.Windows.Form;就写成public class Login : Form 没有就写public class Login : System.Windows.Forms.Form
public class Login 继承 System.Windows.Forms.Form
之前的代码中如果有using System.Windows.Form; 那么public class Login : System.Windows.Forms.Form 和 public class Login :Form 这两句代码是等效的,否则public class Login :Form 编译会报错。
自动生成的窗体代码,会using System.Windows.Forms
所以只需要用Form,简写的名字。
那么
public class Login : System.Windows.Forms.Form和public class Login : Form 是一样的,如果类前没有using System.Windows.Form;
那么public class Login : Form 编译时会出错
没有就写public class Login : System.Windows.Forms.Form
那么public class Login : System.Windows.Forms.Form 和 public class Login :Form 这两句代码是等效的,否则public class Login :Form 编译会报错。
如果您使用自建的Windows窗体的话,那么需要自己引入一个命名空间.如上所示.
也可以参考大家的意见,使用using语句引入System.Windows.Forms.Form命名空间.
所有窗体类都继承自该类型.
前者指定的Form 是属于System.Windows.Forms命名空间下的.
而System.Windows.Forms一般在程序的前几行就已经用 using 这种方式引用了.
1、事先没有引入命名空间System.Windows.Forms的话,就得写成public class Login : System.Windows.Forms.Form
2、事先已经引入命名空间System.Windows.Forms.Form的话,可以简写成public class Login : Form,当然要是仍然写成public class Login : System.Windows.Forms.Form也没问题
如果是在开发工具中新建的窗体:
至少在vs2005中,自动生成的代码是这样的:public class Login : Form,系统已经引入了命名空间