如何打开窗体 [英] How can open window form

查看:82
本文介绍了如何打开窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,



我需要ado.net的帮助我想做什么我知道我该怎么做。



http://oi50.tinypic.com/m7fie.jpg







http://i48.tinypic.com/avhjti.png [ ^ ]



我有窗口应用程序,我想打开一个表格,如示例图像。

我现在想做什么当用户在我的用户系统上完成我的应用程序安装时,用户可以单击图标来运行该应用程序。将有一个主窗口窗口,用户可以访问所有功能,但当主窗体出来时,我也想要一个激活表格打开主要从这个窗体永远不会隐藏关闭

直到然后用户永远不会激活应用程序并输入代码。

所以我如何打开激活表格打开主菜单。



希望你我的帮助我

谢谢

解决方案

看看这个: Form.ShowDialog [ ^ ]。阅读完毕后,您应该能够完成此任务。


要在主应用程序中显示子表单,您必须先在应用程序中定义子表单,然后根据您的方法调用以下方法需要。

例如:此示例将您的子表单显示为模型对话框,阻止用户访问主表单,除非他/她关闭子表单。

  private   void  child1Button_Click( object  sender,EventArgs e)
{
Form2 testDialog = new Form2();

// 将testDialog显示为模态对话框并确定DialogResult = OK。
if (testDialog.ShowDialog( this )== DialogResult.OK)
{
// 执行成功操作
}
else
{
// 子表单取消
}
testDialog.Dispose();

}





将您的孩子显示为无模式对话框。

  private   void  child1Button_Click( object  sender,EventArgs e)
{
Form2 testDialog = new Form2();
testDialog.Show();
}


Quote:

hi bikramjeet,

我遇到了你的问题。我在创建许可应用程序时也遇到了同样的问题。幸运的是我看到了你的问题。



我认为以下代码(vb.net)将解决你的问题



 Dim frm As new frmLicense 
Private Sub MainForm_Activated(ByVal sender As Object,ByVal e As System.EventArgs)Handles Me.Activated
如果不是frm.IsDisposed那么
frm.Focus()
结束如果
结束Sub

Private Sub MainForm_Load(ByVal sender As Object,ByVal e As System.EventArgs )Handles Me.Load
frm.TopMost = True
frm.Show()
End Sub





我写了简单的代码。 frmlicense是您的许可证激活弹出窗体。如果你愿意,我建议让它成为单身人士。你可以使用任何转换器来获取c#代码。不要以为它需要。



这肯定会解决你的问题。如果你觉得这个合适,那就接受为解决方案。所以对其他人也有帮助。


Hello friend,

I need a help in ado.net what i want to do i did know how can i do that.

http://oi50.tinypic.com/m7fie.jpg

Or

http://i48.tinypic.com/avhjti.png[^]

I have window application and i want to open one form like example image.
What I want to do now when user complete installation of my application on user system
the user can click on icon for run the application. There will be come Main Window form where user can able to tack access of all functions but when Main form will come out then i also want a Activation Form Open upon a Main from this form never hid close
till then user never Activate the Application with enter the code.
so how can i open Activation Form Open upon a Main from.

hope you my help me in it
Thanks

解决方案

Have a look at this: Form.ShowDialog[^]. You should be able to accomplish this after reading that.


To display a child forms from your main application you have to first define your child forms in your application and call the following methods based on your need.
eg: This examples displays your child form as Model dialog which blocks the user to access the main form unless he/she close the child form.

private void child1Button_Click(object sender, EventArgs e)
{
  Form2 testDialog = new Form2();

  // Show testDialog as a modal dialog and determine if DialogResult = OK.
  if (testDialog.ShowDialog(this) == DialogResult.OK)
  {
     //do success operation
  }
  else
  {
     // Child form is cancelled
  }
  testDialog.Dispose();

}



To display your child as Modeless dialog.

private void child1Button_Click(object sender, EventArgs e)
 {
   Form2 testDialog = new Form2();
   testDialog.Show();
 }


Quote:

hi bikramjeet,
I got your problem. I also faced same problem while creating licensed application.Luckily i saw your problem.

I think following code (vb.net) will solve your problem

Dim frm As New frmLicense
    Private Sub MainForm_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
        If Not frm.IsDisposed Then
            frm.Focus()
        End If
    End Sub

    Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        frm.TopMost = True
        frm.Show()
    End Sub



I have written simple code. frmlicense is your license activation popup form. I suggest make it singleton if u want. U can use any converter to get c# code. don''t think its needed.

This will definitely solve your problem. If u find this suitable,accept as solution.So it will be helpful to other also.


这篇关于如何打开窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆