位置于:书籍教程首页>>编程开发>>Asp.net教程>>正文
 如何不使用可视化设计来显示登陆窗体?

论坛看到这个帖子,觉得有意思,就实现了一下。其实这个问题以前的高人写了文章的。好像是net_lover吧,记的不是很清楚。

代码如下:

using System;using System.Windows.Forms;class test{ Form frm = new Form(); Button btnOK = new Button(); TextBox txtPsw = new TextBox();  static void Main(string [] args) {  test temp = new test();  temp.showFrm();  //Console.ReadLine(); }  private void showFrm() {  btnOK.Text = "确定";  frm.Text = "登陆";  txtPsw.Location = new System.Drawing.Point(10,10);  btnOK.Location = new System.Drawing.Point(txtPsw.Left,txtPsw.Top + txtPsw.Height + 10);  btnOK.Click += new System.EventHandler(btnOKClick);  frm.FormBorderStyle = FormBorderStyle.FixedDialog;  frm.Controls.Add(txtPsw);  frm.Controls.Add(btnOK);  frm.StartPosition = FormStartPosition.CenterScreen;  frm.ShowDialog(); }  private void btnOKClick(object sender, System.EventArgs e) {  //验证信息  MessageBox.Show(txtPsw.Text); }}

http://www.xp163.com/共享:
 网站最新更新
 如何不使用可视化设计来显示登陆窗体?相关

 

 书籍教程站内推荐信息
 书籍教程网站地图