VS2003。NET WIN CE 平台
用户登陆成功后,登陆窗体关闭,主窗体运行,但是主窗体是最小化的,怎么才能让主窗体运行是最大化的?
主窗体的WindowState设置成Maximized也不行啊?
登陆窗体
private void Btn_OK_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.OK;
}主窗体
static void Main()
{
LoginForm lf = new LoginForm();
lf.ShowDialog();
if(lf.DialogResult ==DialogResult.OK )
{
Application.Run(new MainForm(lf.GetID,lf.GetName));
}
}
用户登陆成功后,登陆窗体关闭,主窗体运行,但是主窗体是最小化的,怎么才能让主窗体运行是最大化的?
主窗体的WindowState设置成Maximized也不行啊?
登陆窗体
private void Btn_OK_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.OK;
}主窗体
static void Main()
{
LoginForm lf = new LoginForm();
lf.ShowDialog();
if(lf.DialogResult ==DialogResult.OK )
{
Application.Run(new MainForm(lf.GetID,lf.GetName));
}
}
解决方案 »
- 看代码,大侠帮忙找原因咯。
- 请问C#如果读写注册表二进制值?
- 高分求代码:让Spread显示内容移动到最底端
- 关于remoting ,如何让客户端不需要服务对象的dll,
- 类似3.5.2和3.5.3这样的字段设置为什么数据类型?
- 高手快来???
- 想知道C#的一些优点~
- 求助:装了2000 professional 系统怎么只有Personal Web Manager,没有IIS呢???
- 无法在web服务器上启动调试。登录失败:未知的用户名或者密码错误
- 关于动态生成crystal report的问题!
- vs2005 professional简体中文正式版下载
- 不可序列话的类的实例不能在remoting中传递吗???
LoginForm lf = new LoginForm();
lf.ShowDialog();
写到主窗体的Load事件里。否则主窗体将不会得到焦点,不论是你如何操作。但应该不是最小化吧。
lf.ShowDialog();
写到主窗体的Load事件里 这个方法不行,程序直接就退出了
//一下是Form2,也就是弹出来的第一个窗体
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;namespace JustTest
{
/// <summary>
/// Form2 的摘要说明。
/// </summary>
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
public Form2()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
//
// button1
//
this.button1.Location = new System.Drawing.Point(68, 48);
this.button1.Size = new System.Drawing.Size(68, 24);
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form2
//
this.ClientSize = new System.Drawing.Size(202, 123);
this.Controls.Add(this.button1);
this.Text = "Form2";
this.Closed += new System.EventHandler(this.Form2_Closed); }
#endregion private bool blResult = false;
private void button1_Click(object sender, System.EventArgs e)
{
blResult = true;
} private void Form2_Closed(object sender, System.EventArgs e)
{
this.DialogResult = blResult?DialogResult.OK:DialogResult.Cancel;
}
}
}
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;namespace JustTest
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
//
// Form1
//
this.ClientSize = new System.Drawing.Size(266, 163);
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary> static void Main()
{
Application.Run(new Form1());
} private void Form1_Load(object sender, System.EventArgs e)
{
Form2 frm = new Form2();
if(frm.ShowDialog()!=DialogResult.OK)
{
Application.Exit();
}
}
}
}
using System.Windows.Forms;namespace SmartDeviceApplication1
{
/// <summary>
/// Summary description for main.
/// </summary>
public class main
{
/// <summary>
/// the main entry point of the application
/// </summary>
static void Main()
{
Application.Run(new MainForm ());
}
}
}
主窗体:
private void MainForm_Load(object sender, System.EventArgs e)
{
dialog d = new dialog();
DialogResult dr = d.ShowDialog();
if(d.DialogResult == DialogResult.OK)
{
//这里就是你MainForm load的时候要做的事。
}
} private void button1_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.OK;
}登陆窗体
private void Btn_OK_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.OK;
}如wuyazhe(我的宝贝叫阿刺)缩说的。