C# Mainform.cs读取例程两次以上
真正的问题: 主窗体读取例程超过两次。MainForm中的所有组件和对象都是空的 例如: 按钮第一次运行非常好 添加我的代码:C# Mainform.cs读取例程两次以上,c#,.net,winforms,mono,C#,.net,Winforms,Mono,真正的问题: 主窗体读取例程超过两次。MainForm中的所有组件和对象都是空的 例如: 按钮第一次运行非常好 添加我的代码: namespace CheckNet { /// <summary> /// Description of MainForm. /// </summary> delegate void Function(); public partial class MainForm : Form {
namespace CheckNet
{
/// <summary>
/// Description of MainForm.
/// </summary>
delegate void Function();
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
Btn_Inicio.Click += new EventHandler (Btn_InicioClick);
// VerificationForm += new EventHandler (VerificationForm);
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
private DPFP.Template Template;
private DPFP.Template myTemplate;
//
void Btn_InicioClick(object sender, EventArgs e)
{
// call rutine ejecutar boton primera vez
//
if (this.panelContenedor.Controls.Count > 0)
this.panelContenedor.Controls.RemoveAt(0);
VerificationForm hijos = new VerificationForm();
hijos.TopLevel = false;
hijos.FormBorderStyle = FormBorderStyle.None;
hijos.Dock = DockStyle.Fill;
this.panelContenedor.Controls.Add(hijos);
this.panelContenedor.Tag = hijos;
hijos.Show();
}
void Button7Click(object sender, EventArgs e)
{
AddFormInPanel(new Hijo2());
}
private void AddFormInPanel(object formHijo)
{
if (this.panelContenedor.Controls.Count > 0)
this.panelContenedor.Controls.RemoveAt(0);
Form fh = formHijo as Form;
fh.TopLevel = false;
fh.FormBorderStyle = FormBorderStyle.None;
fh.Dock = DockStyle.Fill;
this.panelContenedor.Controls.Add(fh);
this.panelContenedor.Tag = fh;
fh.Show();
}
void Close_bottonClick(object sender, EventArgs e)
{
Close();
}
}
}
如果用户请求再次运行相同的按钮
验证表单例程和居民都是捕获式数字角色设备,无法读取指纹
如何清空或重置程序或例程(MainForm、VerificationForm和CaptureForm)
谢谢。解决方案是:
修改program.cs
private static void Main (string [] args)
{
Application.EnableVisualStyles ();
Application.SetCompatibleTextRenderingDefault (false);
Fm1 MainForm = new MainForm ();
Application.Run (fm1);
if (fm1.ToRestart)
Application.Restart ();
}
开始
重新启动公共bool=false
void Btn_InicioClick (object sender, EventArgs e)
{
ToRestart = true;
this.Close ();
}
重置指纹读取器和winform控件的步骤
Thankflow:open Main Form:button to prepare the fingerprint reader open VerificationForm.cs CaptureForm.cs call------如果可以读取设备,请执行以下步骤------如果用户请求再次按下按钮------此处:button to prepare the fingerprint reader openVerificationForm.cs CaptureForm.cs call----指纹读取器设备已锁定----------------------------------如何接通、清空或重置。不想关闭程序并重新打开------------------谢谢。
void Btn_InicioClick (object sender, EventArgs e)
{
ToRestart = true;
this.Close ();
}